mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
refactored ZMQ_ROUTER_ANNOUNCE_SELF code. renamed it to ZMQ_PROBE_NEW_PEERS.
implement it for DEALER tocket. +documentation
This commit is contained in:
parent
d5f603690f
commit
97324398a7
@ -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
|
||||
|
@ -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 ();
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user