Commit d7adc3f1 authored by Martin Sustrik's avatar Martin Sustrik

ZMQ_FILTER option removed

The filtering is now done depending on the socket type. SUB socket
filters the messages (end-to-end filtering) while XSUB relies
on upstream nodes to do (imprefect) filtering.
Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent a154ef69
...@@ -320,23 +320,6 @@ Default value:: 1 ...@@ -320,23 +320,6 @@ Default value:: 1
Applicable socket types:: all, when using multicast transports Applicable socket types:: all, when using multicast transports
ZMQ_FILTER: Switches message filtering on or off
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The option shall retrieve the filtering behaiour of the socket.
If 1, messages are filtered according to subcriptions as expected.
If 0, messages are not filtered. This is a performance tweak. If a device
receives a message from XSUB socket and it is about to send it to XPUB socket
immediately, filtering would be done twice. We can thus turn off filtering in
XSUB socket and rely on filtering in XPUB socket.
[horizontal]
Option value type:: int
Option value unit:: boolean
Default value:: 1
Applicable socket types:: ZMQ_SUB, ZMQ_XSUB
ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN ZMQ_RCVTIMEO: Maximum time before a socket operation returns with EAGAIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
...@@ -312,22 +312,6 @@ Default value:: 1 ...@@ -312,22 +312,6 @@ Default value:: 1
Applicable socket types:: all, when using multicast transports Applicable socket types:: all, when using multicast transports
ZMQ_FILTER: Switches message filtering on or off
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If set to 1, messages are filtered according to subcriptions as expected.
If set to 0, messages are not filtered. This is a performance tweak. If a device
receives a message from XSUB socket and it is about to send it to XPUB socket
immediately, filtering would be done twice. We can thus turn off filtering in
XSUB socket and rely on filtering in XPUB socket.
[horizontal]
Option value type:: int
Option value unit:: boolean
Default value:: 1
Applicable socket types:: ZMQ_SUB, ZMQ_XSUB
ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN ZMQ_RCVTIMEO: Maximum time before a recv operation returns with EAGAIN
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
...@@ -182,7 +182,6 @@ ZMQ_EXPORT int zmq_term (void *context); ...@@ -182,7 +182,6 @@ ZMQ_EXPORT int zmq_term (void *context);
#define ZMQ_SNDHWM 23 #define ZMQ_SNDHWM 23
#define ZMQ_RCVHWM 24 #define ZMQ_RCVHWM 24
#define ZMQ_MULTICAST_HOPS 25 #define ZMQ_MULTICAST_HOPS 25
#define ZMQ_FILTER 26
#define ZMQ_RCVTIMEO 27 #define ZMQ_RCVTIMEO 27
#define ZMQ_SNDTIMEO 28 #define ZMQ_SNDTIMEO 28
#define ZMQ_RCVLABEL 29 #define ZMQ_RCVLABEL 29
......
...@@ -38,12 +38,12 @@ zmq::options_t::options_t () : ...@@ -38,12 +38,12 @@ zmq::options_t::options_t () :
reconnect_ivl_max (0), reconnect_ivl_max (0),
backlog (100), backlog (100),
maxmsgsize (-1), maxmsgsize (-1),
filter (1),
rcvtimeo (-1), rcvtimeo (-1),
sndtimeo (-1), sndtimeo (-1),
immediate_connect (true), immediate_connect (true),
delay_on_close (true), delay_on_close (true),
delay_on_disconnect (true) delay_on_disconnect (true),
filter (false)
{ {
} }
...@@ -177,15 +177,6 @@ int zmq::options_t::setsockopt (int option_, const void *optval_, ...@@ -177,15 +177,6 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
multicast_hops = *((int*) optval_); multicast_hops = *((int*) optval_);
return 0; return 0;
case ZMQ_FILTER:
if (optvallen_ != sizeof (int) || (*((int*) optval_) != 0 &&
*((int*) optval_) != 1)) {
errno = EINVAL;
return -1;
}
filter = *((int*) optval_);
return 0;
case ZMQ_RCVTIMEO: case ZMQ_RCVTIMEO:
if (optvallen_ != sizeof (int)) { if (optvallen_ != sizeof (int)) {
errno = EINVAL; errno = EINVAL;
...@@ -347,15 +338,6 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_) ...@@ -347,15 +338,6 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
*optvallen_ = sizeof (int); *optvallen_ = sizeof (int);
return 0; return 0;
case ZMQ_FILTER:
if (*optvallen_ < sizeof (int)) {
errno = EINVAL;
return -1;
}
*((int*) optval_) = filter;
*optvallen_ = sizeof (int);
return 0;
case ZMQ_RCVTIMEO: case ZMQ_RCVTIMEO:
if (*optvallen_ < sizeof (int)) { if (*optvallen_ < sizeof (int)) {
errno = EINVAL; errno = EINVAL;
......
...@@ -75,9 +75,6 @@ namespace zmq ...@@ -75,9 +75,6 @@ namespace zmq
// Maximal size of message to handle. // Maximal size of message to handle.
int64_t maxmsgsize; int64_t maxmsgsize;
// If 1, (X)SUB socket should filter the messages. If 0, it should not.
int filter;
// The timeout for send/recv operations for this socket. // The timeout for send/recv operations for this socket.
int rcvtimeo; int rcvtimeo;
int sndtimeo; int sndtimeo;
...@@ -95,6 +92,9 @@ namespace zmq ...@@ -95,6 +92,9 @@ namespace zmq
// If true, socket reads all the messages from the pipe and delivers // If true, socket reads all the messages from the pipe and delivers
// them to the user when the peer terminates. // them to the user when the peer terminates.
bool delay_on_disconnect; bool delay_on_disconnect;
// If 1, (X)SUB socket should filter the messages. If 0, it should not.
bool filter;
}; };
} }
......
...@@ -25,6 +25,10 @@ zmq::sub_t::sub_t (class ctx_t *parent_, uint32_t tid_) : ...@@ -25,6 +25,10 @@ zmq::sub_t::sub_t (class ctx_t *parent_, uint32_t tid_) :
xsub_t (parent_, tid_) xsub_t (parent_, tid_)
{ {
options.type = ZMQ_SUB; options.type = ZMQ_SUB;
// Switch filtering messages on (as opposed to XSUB which where the
// filtering is off).
options.filter = true;
} }
zmq::sub_t::~sub_t () zmq::sub_t::~sub_t ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment