summaryrefslogtreecommitdiff
path: root/src/connect_session.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-02-17 10:33:38 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-02-17 10:33:38 +0100
commit28f3e87fc6c8c5c7046234bf9a08ae62f26d7f3a (patch)
treee926ac76c70ca42d208977c23f7d9057a0b1315a /src/connect_session.cpp
parentfbe5d859f461b0deaa6083fdee077e01e9b47b91 (diff)
Add delay before reconnecting
So far ZMQ_RECONNECT_IVL delay was used only when TCP connect failed. Now it is used even if connect succeeds and the peer closes the connection afterwards. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/connect_session.cpp')
-rw-r--r--src/connect_session.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/connect_session.cpp b/src/connect_session.cpp
index da46568..62799b3 100644
--- a/src/connect_session.cpp
+++ b/src/connect_session.cpp
@@ -38,10 +38,10 @@ zmq::connect_session_t::~connect_session_t ()
void zmq::connect_session_t::process_plug ()
{
// Start connection process immediately.
- start_connecting ();
+ start_connecting (false);
}
-void zmq::connect_session_t::start_connecting ()
+void zmq::connect_session_t::start_connecting (bool wait_)
{
// Choose I/O thread to run connecter in. Given that we are already
// running in an I/O thread, there must be at least one available.
@@ -54,7 +54,8 @@ void zmq::connect_session_t::start_connecting ()
if (protocol == "tcp" || protocol == "ipc") {
zmq_connecter_t *connecter = new (std::nothrow) zmq_connecter_t (
- io_thread, this, options, protocol.c_str (), address.c_str ());
+ io_thread, this, options, protocol.c_str (), address.c_str (),
+ wait_);
zmq_assert (connecter);
launch_child (connecter);
return;
@@ -112,6 +113,6 @@ void zmq::connect_session_t::attached (const blob_t &peer_identity_)
void zmq::connect_session_t::detached ()
{
// Reconnect.
- start_connecting ();
+ start_connecting (true);
}