Commit 7b4cf2a4 authored by Martin Sustrik's avatar Martin Sustrik

Multi-hop REQ/REP, part I., socket type is known to all associated objects

parent cd7300fd
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
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,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#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,6 +34,9 @@ namespace zmq ...@@ -34,6 +34,9 @@ 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;
......
...@@ -29,6 +29,7 @@ zmq::p2p_t::p2p_t (class app_thread_t *parent_) : ...@@ -29,6 +29,7 @@ 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,6 +27,7 @@ ...@@ -27,6 +27,7 @@
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,6 +30,7 @@ zmq::rep_t::rep_t (class app_thread_t *parent_) : ...@@ -30,6 +30,7 @@ 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,6 +30,7 @@ zmq::req_t::req_t (class app_thread_t *parent_) : ...@@ -30,6 +30,7 @@ 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,6 +28,7 @@ zmq::sub_t::sub_t (class app_thread_t *parent_) : ...@@ -28,6 +28,7 @@ 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,6 +25,7 @@ ...@@ -25,6 +25,7 @@
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,6 +25,7 @@ ...@@ -25,6 +25,7 @@
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;
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
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;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment