add option to stop trying to reconnect on ECONNREFUSED (#3831)

* add option to stop trying to reconnect on ECONNREFUSED
This commit is contained in:
Bill Torpey
2020-02-23 12:17:22 -05:00
committed by GitHub
parent 66ee3ee46c
commit debbe08fb8
17 changed files with 377 additions and 33 deletions

View File

@@ -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;