mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 19:52:00 +01: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:
@@ -45,6 +45,7 @@ zmq::options_t::options_t () :
|
||||
ipv6 (0),
|
||||
immediate (0),
|
||||
filter (false),
|
||||
invert_matching(false),
|
||||
recv_identity (false),
|
||||
raw_socket (false),
|
||||
raw_notify (false),
|
||||
@@ -500,6 +501,13 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
|
||||
}
|
||||
break;
|
||||
|
||||
case ZMQ_INVERT_MATCHING:
|
||||
if (is_int) {
|
||||
invert_matching = (value != 0);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
#if defined (ZMQ_ACT_MILITANT)
|
||||
// There are valid scenarios for probing with unknown socket option
|
||||
@@ -846,6 +854,13 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
|
||||
}
|
||||
break;
|
||||
|
||||
case ZMQ_INVERT_MATCHING:
|
||||
if (is_int) {
|
||||
*value = invert_matching;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
#if defined (ZMQ_ACT_MILITANT)
|
||||
malformed = false;
|
||||
|
||||
Reference in New Issue
Block a user