mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-19 08:46:44 +01:00
Simplify {tcp|ipc}_connecter
Make start_connecting () to have singe exit point.
This commit is contained in:
parent
e0fed9d29a
commit
ec9f8994a7
@ -142,7 +142,6 @@ void zmq::ipc_connecter_t::start_connecting ()
|
||||
handle = add_fd (s);
|
||||
handle_valid = true;
|
||||
out_event ();
|
||||
return;
|
||||
}
|
||||
|
||||
// Connection establishment may be delayed. Poll for its completion.
|
||||
@ -151,12 +150,13 @@ void zmq::ipc_connecter_t::start_connecting ()
|
||||
handle_valid = true;
|
||||
set_pollout (handle);
|
||||
session->monitor_event (ZMQ_EVENT_CONNECT_DELAYED, endpoint.c_str(), zmq_errno());
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle any other error condition by eventual reconnect.
|
||||
close ();
|
||||
add_reconnect_timer();
|
||||
else {
|
||||
close ();
|
||||
add_reconnect_timer ();
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::ipc_connecter_t::add_reconnect_timer()
|
||||
|
@ -155,7 +155,6 @@ void zmq::tcp_connecter_t::start_connecting ()
|
||||
handle = add_fd (s);
|
||||
handle_valid = true;
|
||||
out_event ();
|
||||
return;
|
||||
}
|
||||
|
||||
// Connection establishment may be delayed. Poll for its completion.
|
||||
@ -164,12 +163,13 @@ void zmq::tcp_connecter_t::start_connecting ()
|
||||
handle_valid = true;
|
||||
set_pollout (handle);
|
||||
session->monitor_event (ZMQ_EVENT_CONNECT_DELAYED, endpoint.c_str(), zmq_errno());
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle any other error condition by eventual reconnect.
|
||||
close ();
|
||||
add_reconnect_timer();
|
||||
else {
|
||||
close ();
|
||||
add_reconnect_timer ();
|
||||
}
|
||||
}
|
||||
|
||||
void zmq::tcp_connecter_t::add_reconnect_timer()
|
||||
|
Loading…
x
Reference in New Issue
Block a user