better naming of flags and variables to real functionality: nodrop

This commit is contained in:
kreuzberger 2014-08-08 19:45:41 +02:00
parent d9a3cc48d4
commit f042ea9e26
7 changed files with 15 additions and 15 deletions

View File

@ -307,7 +307,7 @@ ZMQ_EXPORT const char *zmq_msg_gets (zmq_msg_t *msg, const char *property);
#define ZMQ_HANDSHAKE_IVL 66
#define ZMQ_IDENTITY_FD 67
#define ZMQ_SOCKS_PROXY 68
#define ZMQ_XPUB_WAIT 69
#define ZMQ_XPUB_NODROP 69
/* Message options */
#define ZMQ_MORE 1

View File

@ -458,9 +458,9 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
return 0;
}
break;
case ZMQ_XPUB_WAIT:
case ZMQ_XPUB_NODROP:
{
pubWait = true;
pub_nodrop = true;
return 0;
}
break;
@ -811,9 +811,9 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
}
break;
case ZMQ_XPUB_WAIT:
case ZMQ_XPUB_NODROP:
if( is_int) {
*value = pubWait;
*value = pub_nodrop;
return 0;
}
break;

View File

@ -179,8 +179,8 @@ namespace zmq
// close socket. Default is 30 secs. 0 means no handshake timeout.
int handshake_ivl;
// flag if PUB socket should block if reaching HWM
bool pubWait;
// flag if PUB socket should not drop messages if reaching HWM
bool pub_nodrop;
};
}

View File

@ -90,7 +90,7 @@ void zmq::xpub_t::xwrite_activated (pipe_t *pipe_)
int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
size_t optvallen_)
{
if (option_ != ZMQ_XPUB_VERBOSE && option_ != ZMQ_XPUB_WAIT) {
if (option_ != ZMQ_XPUB_VERBOSE && option_ != ZMQ_XPUB_NODROP) {
errno = EINVAL;
return -1;
}
@ -100,8 +100,8 @@ int zmq::xpub_t::xsetsockopt (int option_, const void *optval_,
}
if (option_ == ZMQ_XPUB_VERBOSE) {
verbose = (*static_cast <const int*> (optval_) != 0);
} else if (option_ == ZMQ_XPUB_WAIT) {
wait = (*static_cast <const int*> (optval_) != 0);
} else if (option_ == ZMQ_XPUB_NODROP) {
nodrop = (*static_cast <const int*> (optval_) != 0);
}
else {
return -1;
@ -135,7 +135,7 @@ int zmq::xpub_t::xsend (msg_t *msg_)
subscriptions.match ((unsigned char*) msg_->data (), msg_->size (),
mark_as_matching, this);
if (wait && !dist.check_hwm()) {
if (nodrop && !dist.check_hwm()) {
return EAGAIN;
}

View File

@ -79,8 +79,8 @@ namespace zmq
// True if we are in the middle of sending a multi-part message.
bool more;
// wait for reaching LWM if HWM is reached
bool wait;
// dont drop messages if hwm reached, just return with EAGAIN
bool nodrop;
// List of pending (un)subscriptions, ie. those that were already
// applied to the trie, but not yet received by the user.

View File

@ -105,7 +105,7 @@ int test_blocking (int send_hwm, int msgCnt)
//set a hwm on publisher
rc = zmq_setsockopt (pub_socket, ZMQ_SNDHWM, &send_hwm, sizeof (send_hwm));
int wait = 1;
rc = zmq_setsockopt (pub_socket, ZMQ_XPUB_WAIT, &wait, sizeof(wait));
rc = zmq_setsockopt (pub_socket, ZMQ_XPUB_NODROP, &wait, sizeof(wait));
rc = zmq_setsockopt( sub_socket, ZMQ_SUBSCRIBE, 0, 0);
// Send until we block

View File

@ -33,7 +33,7 @@ int main (void)
// set pub socket options
int wait = 1;
rc = zmq_setsockopt (pub, ZMQ_XPUB_WAIT, &wait, 4);
rc = zmq_setsockopt (pub, ZMQ_XPUB_NODROP, &wait, 4);
assert (rc == 0);
int hwm = 2000;