diff --git a/doc/zmq_setsockopt.txt b/doc/zmq_setsockopt.txt index 6fa0cc75..7f8fdc93 100644 --- a/doc/zmq_setsockopt.txt +++ b/doc/zmq_setsockopt.txt @@ -421,21 +421,19 @@ Default value:: 0 Applicable socket types:: ZMQ_ROUTER -ZMQ_PROBE: automatically send empty packet to every established connection +ZMQ_PROBE_NEW_PEERS: automatically send empty packet to every established connection ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Sets the compatible sockets behavior to automatically send an empty packet +Sets the 'ROUTER' & 'DEALER' sockets behavior to automatically send an empty packet to any new connection made (or accepted) by socket. It could help sockets to -auto discovery them-self. It especially important in 'ROUTER' <-> 'ROUTER' connections +auto discovery themself. It especially important in 'ROUTER' <-> 'ROUTER' connections where it solves 'who will write first' problems. -NOTE: Don't set this options for sockets working with ZMQ_REP, ZMQ_REQ sockets. -It will interfere with their strict synchronous logic and framing. [horizontal] Option value type:: int Option value unit:: 0, 1 Default value:: 0 -Applicable socket types:: ZMQ_ROUTER, ZMQ_DEALER, ZMQ_REP, ZMQ_REQ +Applicable socket types:: ZMQ_ROUTER, ZMQ_DEALER ZMQ_XPUB_VERBOSE: provide all subscription messages on XPUB sockets diff --git a/src/dealer.cpp b/src/dealer.cpp index 33b0eb68..8fb2f63a 100644 --- a/src/dealer.cpp +++ b/src/dealer.cpp @@ -40,14 +40,14 @@ void zmq::dealer_t::xattach_pipe (pipe_t *pipe_, bool icanhasall_) zmq_assert (pipe_); if (probe_new_peers) { - int rc; + int rc, ok; msg_t probe_msg_; rc = probe_msg_.init (); errno_assert (rc == 0); - rc = pipe_->write (&probe_msg_); - zmq_assert (rc); + ok = pipe_->write (&probe_msg_); + zmq_assert (ok); pipe_->flush (); rc = probe_msg_.close (); diff --git a/src/router.cpp b/src/router.cpp index 49009c69..7357310d 100644 --- a/src/router.cpp +++ b/src/router.cpp @@ -398,12 +398,15 @@ bool zmq::router_t::identify_peer (pipe_t *pipe_) rc = probe_msg_.init (); errno_assert (rc == 0); - rc = pipe_->write (&probe_msg_); - zmq_assert (rc); + ok = pipe_->write (&probe_msg_); pipe_->flush (); rc = probe_msg_.close (); errno_assert (rc == 0); + + // Ignore not probed peers + if (!ok) + return false; } return true;