Simplify {tcp|ipc}_connecter

Make start_connecting () to have singe exit point.
This commit is contained in:
Martin Hurton 2012-06-13 03:34:48 +02:00
parent e0fed9d29a
commit ec9f8994a7
2 changed files with 8 additions and 8 deletions

View File

@ -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()

View File

@ -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()