From 7b4cf2a4d040057f6f378cac2cd125513a859c1b Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 12 Feb 2010 13:33:50 +0100 Subject: Multi-hop REQ/REP, part I., socket type is known to all associated objects --- src/downstream.cpp | 1 + src/options.cpp | 1 + src/options.hpp | 3 +++ src/p2p.cpp | 1 + src/pub.cpp | 1 + src/rep.cpp | 1 + src/req.cpp | 1 + src/sub.cpp | 1 + src/upstream.cpp | 1 + src/xrep.cpp | 1 + src/xreq.cpp | 1 + 11 files changed, 13 insertions(+) diff --git a/src/downstream.cpp b/src/downstream.cpp index 2da08e3..29b0689 100644 --- a/src/downstream.cpp +++ b/src/downstream.cpp @@ -26,6 +26,7 @@ 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 cc02798..f9d93d6 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -23,6 +23,7 @@ #include "err.hpp" zmq::options_t::options_t () : + type (-1), hwm (0), lwm (0), swap (0), diff --git a/src/options.hpp b/src/options.hpp index b066d48..dbe3701 100644 --- a/src/options.hpp +++ b/src/options.hpp @@ -34,6 +34,9 @@ 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; diff --git a/src/p2p.cpp b/src/p2p.cpp index 72bc26b..46bbd0b 100644 --- a/src/p2p.cpp +++ b/src/p2p.cpp @@ -29,6 +29,7 @@ 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 05bfdcf..9a2dcc6 100644 --- a/src/pub.cpp +++ b/src/pub.cpp @@ -27,6 +27,7 @@ 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 b6bffae..b7685b4 100644 --- a/src/rep.cpp +++ b/src/rep.cpp @@ -30,6 +30,7 @@ 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 c9240e0..9b1766e 100644 --- a/src/req.cpp +++ b/src/req.cpp @@ -30,6 +30,7 @@ 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 06ed896..31ee222 100644 --- a/src/sub.cpp +++ b/src/sub.cpp @@ -28,6 +28,7 @@ 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 bdcd5ef..390dcbe 100644 --- a/src/upstream.cpp +++ b/src/upstream.cpp @@ -25,6 +25,7 @@ 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 4cba21c..67a9a39 100644 --- a/src/xrep.cpp +++ b/src/xrep.cpp @@ -25,6 +25,7 @@ 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; } diff --git a/src/xreq.cpp b/src/xreq.cpp index a4310f8..691b66e 100644 --- a/src/xreq.cpp +++ b/src/xreq.cpp @@ -25,6 +25,7 @@ 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; } -- cgit v1.2.3