mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-19 00:46:05 +01:00
async connect bug fixed
This commit is contained in:
parent
d3fb9f90af
commit
37d8371967
@ -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 ()
|
|||||||
|
|
||||||
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 ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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 ();
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user