mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-14 23:07:59 +02:00
Added socket option ZMQ_INVERT_MATCHING.
ZMQ_INVERT_MATCHING reverses the PUB/SUB prefix matching. The subscription list becomes a rejection list. The PUB socket sends messages to all connected (X)SUB sockets that do not have any matching subscription. Whenever the option is used on a PUB/XPUB socket, any connecting SUB sockets must also set it or they will reject everything the publisher sends them. XSUB sockets are unaffected because they do not filter out incoming messages.
This commit is contained in:
@@ -179,9 +179,14 @@ int zmq::xpub_t::xsend (msg_t *msg_)
|
||||
bool msg_more = msg_->flags () & msg_t::more ? true : false;
|
||||
|
||||
// For the first part of multi-part message, find the matching pipes.
|
||||
if (!more)
|
||||
if (!more) {
|
||||
subscriptions.match ((unsigned char*) msg_->data (), msg_->size (),
|
||||
mark_as_matching, this);
|
||||
// If inverted matching is used, reverse the selection now
|
||||
if (options.invert_matching) {
|
||||
dist.reverse_match();
|
||||
}
|
||||
}
|
||||
|
||||
int rc = -1; // Assume we fail
|
||||
if (lossy || dist.check_hwm ()) {
|
||||
|
Reference in New Issue
Block a user