summaryrefslogtreecommitdiff
path: root/src/xpub.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-01-14 12:38:07 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-01-14 12:38:07 +0100
commita348d94c09ab93a19a57ec22a86782e45f1d06ac (patch)
treea866d0a0cef301b94fc33eb7e0c4bf5a56edfa82 /src/xpub.cpp
parent58c9830d90fc39727cec88e48f8985a499aa0ee7 (diff)
Fair queueing of subscriptions added to XPUB socket
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/xpub.cpp')
-rw-r--r--src/xpub.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/xpub.cpp b/src/xpub.cpp
index ed9c0e5..630450b 100644
--- a/src/xpub.cpp
+++ b/src/xpub.cpp
@@ -25,10 +25,11 @@
zmq::xpub_t::xpub_t (class ctx_t *parent_, uint32_t tid_) :
socket_base_t (parent_, tid_),
- dist (this)
+ dist (this),
+ fq (this)
{
options.type = ZMQ_XPUB;
- options.requires_in = false;
+ options.requires_in = true;
options.requires_out = true;
}
@@ -39,14 +40,16 @@ zmq::xpub_t::~xpub_t ()
void zmq::xpub_t::xattach_pipes (class reader_t *inpipe_,
class writer_t *outpipe_, const blob_t &peer_identity_)
{
- zmq_assert (!inpipe_);
+ zmq_assert (inpipe_ && outpipe_);
dist.attach (outpipe_);
+ fq.attach (inpipe_);
}
void zmq::xpub_t::process_term (int linger_)
{
// Terminate the outbound pipes.
dist.terminate ();
+ fq.terminate ();
// Continue with the termination immediately.
socket_base_t::process_term (linger_);
@@ -62,3 +65,13 @@ bool zmq::xpub_t::xhas_out ()
return dist.has_out ();
}
+int zmq::xpub_t::xrecv (zmq_msg_t *msg_, int flags_)
+{
+ return fq.recv (msg_, flags_);
+}
+
+bool zmq::xpub_t::xhas_in ()
+{
+ return fq.has_in ();
+}
+