From 9c522dccaf0b2c8074bd96fbfb4c968f45748ba4 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 16 Sep 2009 11:02:18 +0200 Subject: reconnect added to zmq_connecter --- src/zmq_connecter_init.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/zmq_connecter_init.cpp') diff --git a/src/zmq_connecter_init.cpp b/src/zmq_connecter_init.cpp index 730077a..ffd4a64 100644 --- a/src/zmq_connecter_init.cpp +++ b/src/zmq_connecter_init.cpp @@ -18,6 +18,7 @@ */ #include "zmq_connecter_init.hpp" +#include "zmq_connecter.hpp" #include "io_thread.hpp" #include "session.hpp" #include "err.hpp" @@ -83,8 +84,25 @@ void zmq::zmq_connecter_init_t::flush () void zmq::zmq_connecter_init_t::detach () { - // TODO: Engine is closing down. Init object is to be closed as well. - zmq_assert (false); + // TODO: Start reconnection process here. +/* + // Create a connecter object to attempt reconnect. Ask it to wait for a + // while before reconnecting. + io_thread_t *io_thread = choose_io_thread (options.affinity); + zmq_connecter_t *connecter = new zmq_connecter_t (io_thread, owner, + options, session_name.c_str (), true); + connecter->set_address (...); + zmq_assert (connecter); + send_plug (connecter); + send_own (owner, connecter); +*/ + + // This function is called by engine when disconnection occurs. + // The engine will destroy itself, so we just drop the pointer here and + // start termination of the init object. + engine = NULL; + term (); + } void zmq::zmq_connecter_init_t::process_plug () -- cgit v1.2.3