The description of ZMQ_RECONNECT_STOP_AFTER_DISCONNECT in the zeromq documentation is:
The 'ZMQ_RECONNECT_STOP_AFTER_DISCONNECT' option will stop reconnection when
zmq_disconnect() has been called. This can be useful when the user's request failed
(server not ready), as the socket does not need to continue to reconnect after
user disconnect actively. (https://zeromq.github.io/libzmq/zmq_setsockopt.html)
However, in actual testing, I found that after the socket set the ZMQ_RECONNECT_STOP_AFTER_DISCONNECT option, there is a probability that the reconnection will be abandoned before calling zmq_disconnect.
For the test code above, we expect to see output like this:
Got event: CLOSED
Got event: CONNECT_RETRIED
Got event: CLOSED
Got event: CONNECT_RETRIED
Got event: CLOSED
Got event: CONNECT_RETRIED
Got event: CLOSED
Got event: CONNECT_RETRIED
Got event: CLOSED
Got event: CLOSED
Still waiting for monitor event after 250 ms
Still waiting for monitor event after 500 ms
Still waiting for monitor event after 750 ms
Still waiting for monitor event after 1000 ms
When this problem occurs, the output is like this:
Got event: CLOSED
Still waiting for monitor event after 250 ms
Still waiting for monitor event after 500 ms
Still waiting for monitor event after 750 ms
Still waiting for monitor event after 1000 ms
Issue description
The description of
ZMQ_RECONNECT_STOP_AFTER_DISCONNECT
in the zeromq documentation is: The 'ZMQ_RECONNECT_STOP_AFTER_DISCONNECT' option will stop reconnection when zmq_disconnect() has been called. This can be useful when the user's request failed (server not ready), as the socket does not need to continue to reconnect after user disconnect actively. (https://zeromq.github.io/libzmq/zmq_setsockopt.html)However, in actual testing, I found that after the socket set the
ZMQ_RECONNECT_STOP_AFTER_DISCONNECT
option, there is a probability that the reconnection will be abandoned before callingzmq_disconnect
.For the test code above, we expect to see output like this:
When this problem occurs, the output is like this: