diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-10-17 09:54:12 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-10-17 09:54:12 +0200 |
commit | e8e2944f45eab3e22dc46ceac3225a886ca468ad (patch) | |
tree | cc37fe526ffe74b2f48130ca9810f63cdb518f27 /src/zmq_connecter.cpp | |
parent | 8b8837688a97c4d05aff01a6dea7ac5a35b21fa2 (diff) |
ZMQ_RECONNECT_IVL socket options added.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/zmq_connecter.cpp')
-rw-r--r-- | src/zmq_connecter.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/zmq_connecter.cpp b/src/zmq_connecter.cpp index 82c3ca1..2dd9576 100644 --- a/src/zmq_connecter.cpp +++ b/src/zmq_connecter.cpp @@ -54,20 +54,21 @@ zmq::zmq_connecter_t::~zmq_connecter_t () rm_fd (handle); } -int zmq::zmq_connecter_t::get_reconnect_period () +int zmq::zmq_connecter_t::get_reconnect_ivl () { #if defined ZMQ_HAVE_WINDOWS - return (reconnect_period + (((int)GetCurrentProcessId () * 13) - % reconnect_period)); + return (options.reconnect_ivl + (((int) GetCurrentProcessId () * 13) + % options.reconnect_ivl)); #else - return (reconnect_period + (((int)getpid () * 13) % reconnect_period)); + return (options.reconnect_ivl + (((int) getpid () * 13) + % options.reconnect_ivl)); #endif } void zmq::zmq_connecter_t::process_plug () { if (wait) - add_timer (get_reconnect_period (), reconnect_timer_id); + add_timer (get_reconnect_ivl (), reconnect_timer_id); else start_connecting (); } @@ -90,7 +91,7 @@ void zmq::zmq_connecter_t::out_event () if (fd == retired_fd) { tcp_connecter.close (); wait = true; - add_timer (get_reconnect_period (), reconnect_timer_id); + add_timer (get_reconnect_ivl (), reconnect_timer_id); return; } @@ -139,5 +140,5 @@ void zmq::zmq_connecter_t::start_connecting () // Handle any other error condition by eventual reconnect. wait = true; - add_timer (get_reconnect_period (), reconnect_timer_id); + add_timer (get_reconnect_ivl (), reconnect_timer_id); } |