summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-02-12 19:42:35 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-02-12 19:42:35 +0100
commit313b5dfadd8753b341197cc109bce40e08856cf6 (patch)
tree28cb7ec6f955ca12a28a7cf58fc5751d94227bc7
parent96e0442332fcc680ddafdcaa8fcbdc6acd992c76 (diff)
Multi-hop REQ/REP, part III., change 'type' in options to simple 'traceroute' flag
-rw-r--r--src/downstream.cpp1
-rw-r--r--src/options.cpp4
-rw-r--r--src/options.hpp6
-rw-r--r--src/p2p.cpp1
-rw-r--r--src/pub.cpp1
-rw-r--r--src/rep.cpp1
-rw-r--r--src/req.cpp1
-rw-r--r--src/sub.cpp1
-rw-r--r--src/upstream.cpp1
-rw-r--r--src/xrep.cpp5
-rw-r--r--src/xreq.cpp1
-rw-r--r--src/zmq_init.cpp2
12 files changed, 10 insertions, 15 deletions
diff --git a/src/downstream.cpp b/src/downstream.cpp
index 29b0689..2da08e3 100644
--- a/src/downstream.cpp
+++ b/src/downstream.cpp
@@ -26,7 +26,6 @@
zmq::downstream_t::downstream_t (class app_thread_t *parent_) :
socket_base_t (parent_)
{
- options.type = ZMQ_DOWNSTREAM;
options.requires_in = false;
options.requires_out = true;
}
diff --git a/src/options.cpp b/src/options.cpp
index f9d93d6..cdfccc6 100644
--- a/src/options.cpp
+++ b/src/options.cpp
@@ -23,7 +23,6 @@
#include "err.hpp"
zmq::options_t::options_t () :
- type (-1),
hwm (0),
lwm (0),
swap (0),
@@ -34,7 +33,8 @@ zmq::options_t::options_t () :
sndbuf (0),
rcvbuf (0),
requires_in (false),
- requires_out (false)
+ requires_out (false),
+ traceroute (false)
{
}
diff --git a/src/options.hpp b/src/options.hpp
index dbe3701..f9ff6e4 100644
--- a/src/options.hpp
+++ b/src/options.hpp
@@ -34,9 +34,6 @@ namespace zmq
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 lwm;
int64_t swap;
@@ -59,6 +56,9 @@ namespace zmq
// provided by the specific socket type.
bool requires_in;
bool requires_out;
+
+ // If true, socket requires tracerouting the messages.
+ bool traceroute;
};
}
diff --git a/src/p2p.cpp b/src/p2p.cpp
index 46bbd0b..72bc26b 100644
--- a/src/p2p.cpp
+++ b/src/p2p.cpp
@@ -29,7 +29,6 @@ zmq::p2p_t::p2p_t (class app_thread_t *parent_) :
outpipe (NULL),
alive (true)
{
- options.type = ZMQ_P2P;
options.requires_in = true;
options.requires_out = true;
}
diff --git a/src/pub.cpp b/src/pub.cpp
index 9a2dcc6..05bfdcf 100644
--- a/src/pub.cpp
+++ b/src/pub.cpp
@@ -27,7 +27,6 @@
zmq::pub_t::pub_t (class app_thread_t *parent_) :
socket_base_t (parent_)
{
- options.type = ZMQ_PUB;
options.requires_in = false;
options.requires_out = true;
}
diff --git a/src/rep.cpp b/src/rep.cpp
index b7685b4..b6bffae 100644
--- a/src/rep.cpp
+++ b/src/rep.cpp
@@ -30,7 +30,6 @@ zmq::rep_t::rep_t (class app_thread_t *parent_) :
waiting_for_reply (false),
reply_pipe (NULL)
{
- options.type = ZMQ_REP;
options.requires_in = true;
options.requires_out = true;
}
diff --git a/src/req.cpp b/src/req.cpp
index 9b1766e..c9240e0 100644
--- a/src/req.cpp
+++ b/src/req.cpp
@@ -30,7 +30,6 @@ zmq::req_t::req_t (class app_thread_t *parent_) :
reply_pipe_active (false),
reply_pipe (NULL)
{
- options.type = ZMQ_REQ;
options.requires_in = true;
options.requires_out = true;
}
diff --git a/src/sub.cpp b/src/sub.cpp
index 31ee222..06ed896 100644
--- a/src/sub.cpp
+++ b/src/sub.cpp
@@ -28,7 +28,6 @@ zmq::sub_t::sub_t (class app_thread_t *parent_) :
socket_base_t (parent_),
has_message (false)
{
- options.type = ZMQ_SUB;
options.requires_in = true;
options.requires_out = false;
zmq_msg_init (&message);
diff --git a/src/upstream.cpp b/src/upstream.cpp
index 390dcbe..bdcd5ef 100644
--- a/src/upstream.cpp
+++ b/src/upstream.cpp
@@ -25,7 +25,6 @@
zmq::upstream_t::upstream_t (class app_thread_t *parent_) :
socket_base_t (parent_)
{
- options.type = ZMQ_UPSTREAM;
options.requires_in = true;
options.requires_out = false;
}
diff --git a/src/xrep.cpp b/src/xrep.cpp
index 67a9a39..9462a60 100644
--- a/src/xrep.cpp
+++ b/src/xrep.cpp
@@ -25,9 +25,12 @@
zmq::xrep_t::xrep_t (class app_thread_t *parent_) :
socket_base_t (parent_)
{
- options.type = ZMQ_XREP;
options.requires_in = 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 ()
diff --git a/src/xreq.cpp b/src/xreq.cpp
index 691b66e..a4310f8 100644
--- a/src/xreq.cpp
+++ b/src/xreq.cpp
@@ -25,7 +25,6 @@
zmq::xreq_t::xreq_t (class app_thread_t *parent_) :
socket_base_t (parent_)
{
- options.type = ZMQ_REQ;
options.requires_in = true;
options.requires_out = true;
}
diff --git a/src/zmq_init.cpp b/src/zmq_init.cpp
index 9492caa..b49baa9 100644
--- a/src/zmq_init.cpp
+++ b/src/zmq_init.cpp
@@ -78,7 +78,7 @@ bool zmq::zmq_init_t::write (::zmq_msg_t *msg_)
// Once the initial handshaking is over, XREP sockets should start
// tracerouting individual messages.
- if (options.type == ZMQ_XREP)
+ if (options.traceroute)
engine->traceroute ((unsigned char*) peer_identity.data (),
peer_identity.size ());