From f7f1dfc86dd649edbd789a5d157d74721338c912 Mon Sep 17 00:00:00 2001 From: Thijs Terlouw Date: Wed, 26 Jan 2011 07:01:06 +0100 Subject: ZMQ_RECONNECT_IVL_MAX socket option added It allows for exponential back-off strategy when reconnecting. Signed-off-by: Thijs Terlouw --- src/zmq_connecter.hpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/zmq_connecter.hpp') 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&); }; -- cgit v1.2.3