mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-29 20:59:47 +01:00
Multi-hop REQ/REP, part III., change 'type' in options to simple 'traceroute' flag
This commit is contained in:
@@ -26,7 +26,6 @@
|
|||||||
zmq::downstream_t::downstream_t (class app_thread_t *parent_) :
|
zmq::downstream_t::downstream_t (class app_thread_t *parent_) :
|
||||||
socket_base_t (parent_)
|
socket_base_t (parent_)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_DOWNSTREAM;
|
|
||||||
options.requires_in = false;
|
options.requires_in = false;
|
||||||
options.requires_out = true;
|
options.requires_out = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@
|
|||||||
#include "err.hpp"
|
#include "err.hpp"
|
||||||
|
|
||||||
zmq::options_t::options_t () :
|
zmq::options_t::options_t () :
|
||||||
type (-1),
|
|
||||||
hwm (0),
|
hwm (0),
|
||||||
lwm (0),
|
lwm (0),
|
||||||
swap (0),
|
swap (0),
|
||||||
@@ -34,7 +33,8 @@ zmq::options_t::options_t () :
|
|||||||
sndbuf (0),
|
sndbuf (0),
|
||||||
rcvbuf (0),
|
rcvbuf (0),
|
||||||
requires_in (false),
|
requires_in (false),
|
||||||
requires_out (false)
|
requires_out (false),
|
||||||
|
traceroute (false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,6 @@ namespace zmq
|
|||||||
|
|
||||||
int setsockopt (int option_, const void *optval_, size_t optvallen_);
|
int setsockopt (int option_, const void *optval_, size_t optvallen_);
|
||||||
|
|
||||||
// Type of the associated socket. One of the constants defined in zmq.h
|
|
||||||
int type;
|
|
||||||
|
|
||||||
int64_t hwm;
|
int64_t hwm;
|
||||||
int64_t lwm;
|
int64_t lwm;
|
||||||
int64_t swap;
|
int64_t swap;
|
||||||
@@ -59,6 +56,9 @@ namespace zmq
|
|||||||
// provided by the specific socket type.
|
// provided by the specific socket type.
|
||||||
bool requires_in;
|
bool requires_in;
|
||||||
bool requires_out;
|
bool requires_out;
|
||||||
|
|
||||||
|
// If true, socket requires tracerouting the messages.
|
||||||
|
bool traceroute;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ zmq::p2p_t::p2p_t (class app_thread_t *parent_) :
|
|||||||
outpipe (NULL),
|
outpipe (NULL),
|
||||||
alive (true)
|
alive (true)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_P2P;
|
|
||||||
options.requires_in = true;
|
options.requires_in = true;
|
||||||
options.requires_out = true;
|
options.requires_out = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
zmq::pub_t::pub_t (class app_thread_t *parent_) :
|
zmq::pub_t::pub_t (class app_thread_t *parent_) :
|
||||||
socket_base_t (parent_)
|
socket_base_t (parent_)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_PUB;
|
|
||||||
options.requires_in = false;
|
options.requires_in = false;
|
||||||
options.requires_out = true;
|
options.requires_out = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ zmq::rep_t::rep_t (class app_thread_t *parent_) :
|
|||||||
waiting_for_reply (false),
|
waiting_for_reply (false),
|
||||||
reply_pipe (NULL)
|
reply_pipe (NULL)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_REP;
|
|
||||||
options.requires_in = true;
|
options.requires_in = true;
|
||||||
options.requires_out = true;
|
options.requires_out = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ zmq::req_t::req_t (class app_thread_t *parent_) :
|
|||||||
reply_pipe_active (false),
|
reply_pipe_active (false),
|
||||||
reply_pipe (NULL)
|
reply_pipe (NULL)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_REQ;
|
|
||||||
options.requires_in = true;
|
options.requires_in = true;
|
||||||
options.requires_out = true;
|
options.requires_out = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ zmq::sub_t::sub_t (class app_thread_t *parent_) :
|
|||||||
socket_base_t (parent_),
|
socket_base_t (parent_),
|
||||||
has_message (false)
|
has_message (false)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_SUB;
|
|
||||||
options.requires_in = true;
|
options.requires_in = true;
|
||||||
options.requires_out = false;
|
options.requires_out = false;
|
||||||
zmq_msg_init (&message);
|
zmq_msg_init (&message);
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
zmq::upstream_t::upstream_t (class app_thread_t *parent_) :
|
zmq::upstream_t::upstream_t (class app_thread_t *parent_) :
|
||||||
socket_base_t (parent_)
|
socket_base_t (parent_)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_UPSTREAM;
|
|
||||||
options.requires_in = true;
|
options.requires_in = true;
|
||||||
options.requires_out = false;
|
options.requires_out = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,12 @@
|
|||||||
zmq::xrep_t::xrep_t (class app_thread_t *parent_) :
|
zmq::xrep_t::xrep_t (class app_thread_t *parent_) :
|
||||||
socket_base_t (parent_)
|
socket_base_t (parent_)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_XREP;
|
|
||||||
options.requires_in = true;
|
options.requires_in = true;
|
||||||
options.requires_out = true;
|
options.requires_out = true;
|
||||||
|
|
||||||
|
// XREP socket adds identity to inbound messages and strips identity
|
||||||
|
// from the outbound messages.
|
||||||
|
options.traceroute = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
zmq::xrep_t::~xrep_t ()
|
zmq::xrep_t::~xrep_t ()
|
||||||
|
|||||||
@@ -25,7 +25,6 @@
|
|||||||
zmq::xreq_t::xreq_t (class app_thread_t *parent_) :
|
zmq::xreq_t::xreq_t (class app_thread_t *parent_) :
|
||||||
socket_base_t (parent_)
|
socket_base_t (parent_)
|
||||||
{
|
{
|
||||||
options.type = ZMQ_REQ;
|
|
||||||
options.requires_in = true;
|
options.requires_in = true;
|
||||||
options.requires_out = true;
|
options.requires_out = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ bool zmq::zmq_init_t::write (::zmq_msg_t *msg_)
|
|||||||
|
|
||||||
// Once the initial handshaking is over, XREP sockets should start
|
// Once the initial handshaking is over, XREP sockets should start
|
||||||
// tracerouting individual messages.
|
// tracerouting individual messages.
|
||||||
if (options.type == ZMQ_XREP)
|
if (options.traceroute)
|
||||||
engine->traceroute ((unsigned char*) peer_identity.data (),
|
engine->traceroute ((unsigned char*) peer_identity.data (),
|
||||||
peer_identity.size ());
|
peer_identity.size ());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user