diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-06-11 20:29:56 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-06-11 20:29:56 +0200 |
commit | bd86def1c799a35d5cef0c0a9a1347a18fea227e (patch) | |
tree | 4d70d0053ef86b5a614bd19ad4c5f420017279c7 /src/xpub.cpp | |
parent | 3935258b826adc31815be4f91b2f6eb02bb3c8ed (diff) |
Actual message filtering happens in XPUB socket
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/xpub.cpp')
-rw-r--r-- | src/xpub.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/xpub.cpp b/src/xpub.cpp index 4b41696..9078de3 100644 --- a/src/xpub.cpp +++ b/src/xpub.cpp @@ -91,9 +91,21 @@ void zmq::xpub_t::xterminated (pipe_t *pipe_) dist.terminated (pipe_); } +void zmq::xpub_t::mark_as_matching (pipe_t *pipe_, void *arg_) +{ + xpub_t *self = (xpub_t*) arg_; + self->dist.match (pipe_); +} + int zmq::xpub_t::xsend (msg_t *msg_, int flags_) -{ - return dist.send (msg_, flags_); +{ + // Find the matching pipes. + subscriptions.match ((unsigned char*) msg_->data (), msg_->size (), + mark_as_matching, this); + + // Send the message to all the pipes that were marked as matching + // in the previous step. + return dist.send_to_matching (msg_, flags_); } bool zmq::xpub_t::xhas_out () |