mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-06 13:21:10 +01:00
rebase reconnect-redux on master (#3960)
* add option to stop reconnecting on failed handshake
This commit is contained in:
@@ -582,6 +582,11 @@ void zmq::stream_engine_base_t::mechanism_ready ()
|
||||
alloc_assert (_metadata);
|
||||
}
|
||||
|
||||
if (_has_handshake_timer) {
|
||||
cancel_timer (handshake_timer_id);
|
||||
_has_handshake_timer = false;
|
||||
}
|
||||
|
||||
_socket->event_handshake_succeeded (_endpoint_uri_pair, 0);
|
||||
}
|
||||
|
||||
@@ -689,6 +694,13 @@ void zmq::stream_engine_base_t::error (error_reason_t reason_)
|
||||
|| _mechanism->status () == mechanism_t::handshaking)) {
|
||||
const int err = errno;
|
||||
_socket->event_handshake_failed_no_detail (_endpoint_uri_pair, err);
|
||||
// special case: connecting to non-ZMTP process which immediately drops connection,
|
||||
// or which never responds with greeting, should be treated as a protocol error
|
||||
// (i.e. stop reconnect)
|
||||
if ( ( (reason_ == connection_error) || (reason_ == timeout_error) )
|
||||
&& (_options.reconnect_stop & ZMQ_RECONNECT_STOP_HANDSHAKE_FAILED)) {
|
||||
reason_ = protocol_error;
|
||||
}
|
||||
}
|
||||
|
||||
_socket->event_disconnected (_endpoint_uri_pair, _s);
|
||||
|
||||
Reference in New Issue
Block a user