summaryrefslogtreecommitdiff
path: root/src/zmq_connecter.hpp
diff options
context:
space:
mode:
authorThijs Terlouw <thijsterlouw@gmail.com>2011-01-26 07:01:06 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-01-26 07:01:06 +0100
commitf7f1dfc86dd649edbd789a5d157d74721338c912 (patch)
tree4189c915385050b759eb2a2890adcba25885a476 /src/zmq_connecter.hpp
parent8e61a11b398c95d829f24c388737eb122405c97b (diff)
ZMQ_RECONNECT_IVL_MAX socket option added
It allows for exponential back-off strategy when reconnecting. Signed-off-by: Thijs Terlouw <thijsterlouw@gmail.com>
Diffstat (limited to 'src/zmq_connecter.hpp')
-rw-r--r--src/zmq_connecter.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/zmq_connecter.hpp b/src/zmq_connecter.hpp
index 060f5c9..ef2cd1a 100644
--- a/src/zmq_connecter.hpp
+++ b/src/zmq_connecter.hpp
@@ -55,8 +55,13 @@ namespace zmq
// Internal function to start the actual connection establishment.
void start_connecting ();
- // Internal function to return the reconnect backoff delay.
- int get_reconnect_ivl ();
+ // Internal function to add a reconnect timer
+ void add_reconnect_timer();
+
+ // Internal function to return a reconnect backoff delay.
+ // Will modify the current_reconnect_ivl used for next call
+ // Returns the currently used interval
+ int get_new_reconnect_ivl ();
// Actual connecting socket.
tcp_connecter_t tcp_connecter;
@@ -74,6 +79,9 @@ namespace zmq
// Reference to the session we belong to.
class session_t *session;
+ // Current reconnect ivl, updated for backoff strategy
+ int current_reconnect_ivl;
+
zmq_connecter_t (const zmq_connecter_t&);
const zmq_connecter_t &operator = (const zmq_connecter_t&);
};