mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-03 12:58:05 +01:00
Problem: ZMQ_XPUB_VERBOSE_UNSUBSCRIBE is clumsy
This option has a few issues. The name is long and clumsy. The functonality is not smooth: one must set both this and ZMQ_XPUB_VERBOSE at the same time, or things will break mysteriously. Solution: rename to ZMQ_XPUB_VERBOSER and make an atomic option. That is, implicitly does ZMQ_XPUB_VERBOSE.
This commit is contained in:
parent
da8ce55a14
commit
7f6ed167fc
@ -915,11 +915,11 @@ Default value:: N/A
|
|||||||
Applicable socket types:: ZMQ_SUB
|
Applicable socket types:: ZMQ_SUB
|
||||||
|
|
||||||
|
|
||||||
ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets
|
ZMQ_XPUB_VERBOSE: pass subscribe messages on XPUB socket
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Sets the 'XPUB' socket behaviour on new subscriptions and unsubscriptions.
|
Sets the 'XPUB' socket behaviour on new subscriptions. If enabled,
|
||||||
A value of '0' is the default and passes only new subscription messages to
|
the socket passes all subscribe messages to the caller. If disabled,
|
||||||
upstream. A value of '1' passes all subscription messages upstream.
|
these are not visible to the caller. The default is 0 (disabled).
|
||||||
|
|
||||||
[horizontal]
|
[horizontal]
|
||||||
Option value type:: int
|
Option value type:: int
|
||||||
@ -928,17 +928,12 @@ Default value:: 0
|
|||||||
Applicable socket types:: ZMQ_XPUB
|
Applicable socket types:: ZMQ_XPUB
|
||||||
|
|
||||||
|
|
||||||
ZMQ_XPUB_VERBOSE_UNSUBSCRIBE: provide all unsubscription messages on XPUB sockets
|
ZMQ_XPUB_VERBOSER: pass subscribe and unsubscribe messages on XPUB socket
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Sets the 'XPUB' socket behaviour on new subscriptions and unsubscriptions.
|
Sets the 'XPUB' socket behaviour on new subscriptions and ubsubscriptions.
|
||||||
A value of '0' is the default and passes only the last unsubscription message to
|
If enabled, the socket passes all subscribe and unsubscribe messages to the
|
||||||
upstream. A value of '1' passes all unsubscription messages upstream.
|
caller. If disabled, these are not visible to the caller. The default is 0
|
||||||
|
(disabled).
|
||||||
This behaviour should be enabled in all the intermediary XPUB sockets if
|
|
||||||
ZMQ_XPUB_VERBOSE is also being used in order to allow the correct forwarding
|
|
||||||
of all the unsubscription messages.
|
|
||||||
|
|
||||||
NOTE: This behaviour only takes effect when ZMQ_XPUB_VERBOSE is also enabled.
|
|
||||||
|
|
||||||
[horizontal]
|
[horizontal]
|
||||||
Option value type:: int
|
Option value type:: int
|
||||||
|
@ -335,7 +335,7 @@ ZMQ_EXPORT const char *zmq_msg_group (zmq_msg_t *msg);
|
|||||||
#define ZMQ_HEARTBEAT_IVL 75
|
#define ZMQ_HEARTBEAT_IVL 75
|
||||||
#define ZMQ_HEARTBEAT_TTL 76
|
#define ZMQ_HEARTBEAT_TTL 76
|
||||||
#define ZMQ_HEARTBEAT_TIMEOUT 77
|
#define ZMQ_HEARTBEAT_TIMEOUT 77
|
||||||
#define ZMQ_XPUB_VERBOSE_UNSUBSCRIBE 78
|
#define ZMQ_XPUB_VERBOSER 78
|
||||||
#define ZMQ_CONNECT_TIMEOUT 79
|
#define ZMQ_CONNECT_TIMEOUT 79
|
||||||
#define ZMQ_TCP_MAXRT 80
|
#define ZMQ_TCP_MAXRT 80
|
||||||
#define ZMQ_THREAD_SAFE 81
|
#define ZMQ_THREAD_SAFE 81
|
||||||
|
28
src/xpub.cpp
28
src/xpub.cpp
@ -133,19 +133,23 @@ void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
|
|||||||
int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
|
int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
|
||||||
size_t optvallen_)
|
size_t optvallen_)
|
||||||
{
|
{
|
||||||
if (option_ == ZMQ_XPUB_VERBOSE || option_ == ZMQ_XPUB_VERBOSE_UNSUBSCRIBE ||
|
if (option_ == ZMQ_XPUB_VERBOSE
|
||||||
option_ == ZMQ_XPUB_NODROP || option_ == ZMQ_XPUB_MANUAL)
|
|| option_ == ZMQ_XPUB_VERBOSER
|
||||||
{
|
|| option_ == ZMQ_XPUB_NODROP
|
||||||
|
|| option_ == ZMQ_XPUB_MANUAL) {
|
||||||
if (optvallen_ != sizeof(int) || *static_cast <const int*> (optval_) < 0) {
|
if (optvallen_ != sizeof(int) || *static_cast <const int*> (optval_) < 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (option_ == ZMQ_XPUB_VERBOSE) {
|
||||||
if (option_ == ZMQ_XPUB_VERBOSE)
|
|
||||||
verbose_subs = (*static_cast <const int*> (optval_) != 0);
|
verbose_subs = (*static_cast <const int*> (optval_) != 0);
|
||||||
|
verbose_unsubs = 0;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (option_ == ZMQ_XPUB_VERBOSE_UNSUBSCRIBE)
|
if (option_ == ZMQ_XPUB_VERBOSER) {
|
||||||
verbose_unsubs = (*static_cast <const int*> (optval_) != 0);
|
verbose_subs = (*static_cast <const int*> (optval_) != 0);
|
||||||
|
verbose_unsubs = verbose_subs;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (option_ == ZMQ_XPUB_NODROP)
|
if (option_ == ZMQ_XPUB_NODROP)
|
||||||
lossy = (*static_cast <const int*> (optval_) == 0);
|
lossy = (*static_cast <const int*> (optval_) == 0);
|
||||||
@ -155,15 +159,13 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (option_ == ZMQ_SUBSCRIBE && manual) {
|
if (option_ == ZMQ_SUBSCRIBE && manual) {
|
||||||
if (last_pipe != NULL) {
|
if (last_pipe != NULL)
|
||||||
subscriptions.add((unsigned char *)optval_, optvallen_, last_pipe);
|
subscriptions.add ((unsigned char *)optval_, optvallen_, last_pipe);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (option_ == ZMQ_UNSUBSCRIBE && manual) {
|
if (option_ == ZMQ_UNSUBSCRIBE && manual) {
|
||||||
if (last_pipe != NULL) {
|
if (last_pipe != NULL)
|
||||||
subscriptions.rm((unsigned char *)optval_, optvallen_, last_pipe);
|
subscriptions.rm ((unsigned char *)optval_, optvallen_, last_pipe);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (option_ == ZMQ_XPUB_WELCOME_MSG) {
|
if (option_ == ZMQ_XPUB_WELCOME_MSG) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user