Commit 37d83719 authored by Martin Sustrik's avatar Martin Sustrik

async connect bug fixed

parent d3fb9f90
...@@ -68,13 +68,8 @@ void zmq::zmq_connecter_t::out_event () ...@@ -68,13 +68,8 @@ void zmq::zmq_connecter_t::out_event ()
rm_fd (handle); rm_fd (handle);
handle_valid = false; handle_valid = false;
// If there was error during the connecting, close the socket and wait // TODO: Handle the error condition by eventual reconnect.
// for a while before trying to reconnect. zmq_assert (fd != retired_fd);
if (fd == retired_fd) {
tcp_connecter.close ();
add_timer ();
return;
}
// Create an init object. // Create an init object.
io_thread_t *io_thread = choose_io_thread (options.affinity); io_thread_t *io_thread = choose_io_thread (options.affinity);
...@@ -90,8 +85,7 @@ void zmq::zmq_connecter_t::out_event () ...@@ -90,8 +85,7 @@ void zmq::zmq_connecter_t::out_event ()
void zmq::zmq_connecter_t::timer_event () void zmq::zmq_connecter_t::timer_event ()
{ {
// Reconnect period have elapsed. zmq_assert (false);
start_connecting ();
} }
void zmq::zmq_connecter_t::start_connecting () void zmq::zmq_connecter_t::start_connecting ()
...@@ -106,14 +100,13 @@ void zmq::zmq_connecter_t::start_connecting () ...@@ -106,14 +100,13 @@ void zmq::zmq_connecter_t::start_connecting ()
} }
// Connection establishment may be dealyed. Poll for its completion. // Connection establishment may be dealyed. Poll for its completion.
else if (rc == -1 && errno == EAGAIN) { else if (rc == -1 && errno == EINPROGRESS) {
handle = add_fd (tcp_connecter.get_fd ()); handle = add_fd (tcp_connecter.get_fd ());
handle_valid = true; handle_valid = true;
set_pollout (handle); set_pollout (handle);
return; return;
} }
// If none of the above is true, synchronous error occured. // TODO: Handle the error condition by eventual reconnect.
// Wait for a while and retry. zmq_assert (false);
add_timer ();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment