mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-30 05:29:43 +01:00
add option to stop trying to reconnect on ECONNREFUSED (#3831)
* add option to stop trying to reconnect on ECONNREFUSED
This commit is contained in:
@@ -210,6 +210,7 @@ zmq::options_t::options_t () :
|
||||
linger (-1),
|
||||
connect_timeout (0),
|
||||
tcp_maxrt (0),
|
||||
reconnect_stop (0),
|
||||
reconnect_ivl (100),
|
||||
reconnect_ivl_max (0),
|
||||
backlog (100),
|
||||
@@ -393,6 +394,13 @@ int zmq::options_t::setsockopt (int option_,
|
||||
}
|
||||
break;
|
||||
|
||||
case ZMQ_RECONNECT_STOP:
|
||||
if (is_int) {
|
||||
reconnect_stop = value;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZMQ_RECONNECT_IVL:
|
||||
if (is_int && value >= -1) {
|
||||
reconnect_ivl = value;
|
||||
@@ -933,6 +941,13 @@ int zmq::options_t::getsockopt (int option_,
|
||||
}
|
||||
break;
|
||||
|
||||
case ZMQ_RECONNECT_STOP:
|
||||
if (is_int) {
|
||||
*value = reconnect_stop;
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case ZMQ_RECONNECT_IVL:
|
||||
if (is_int) {
|
||||
*value = reconnect_ivl;
|
||||
|
||||
Reference in New Issue
Block a user