Revert "Revert "Merge branch 'master' of github.com:zeromq/libzmq""

This reverts commit dde69fb9fb928db1850eb209db7aed79e26777fb.
This commit is contained in:
Ian Barber 2012-06-12 14:28:32 +01:00
parent 029d3dfae2
commit bdd4e1351d
6 changed files with 46 additions and 18 deletions

View File

@ -59,13 +59,9 @@ zmq::ipc_connecter_t::ipc_connecter_t (class io_thread_t *io_thread_,
zmq::ipc_connecter_t::~ipc_connecter_t () zmq::ipc_connecter_t::~ipc_connecter_t ()
{ {
if (wait) zmq_assert (!wait);
cancel_timer (reconnect_timer_id); zmq_assert (!handle_valid);
if (handle_valid) zmq_assert (s == retired_fd);
rm_fd (handle);
if (s != retired_fd)
close ();
} }
void zmq::ipc_connecter_t::process_plug () void zmq::ipc_connecter_t::process_plug ()
@ -76,6 +72,24 @@ void zmq::ipc_connecter_t::process_plug ()
start_connecting (); start_connecting ();
} }
void zmq::ipc_connecter_t::process_term (int linger_)
{
if (wait) {
cancel_timer (reconnect_timer_id);
wait = false;
}
if (handle_valid) {
rm_fd (handle);
handle_valid = false;
}
if (s != retired_fd)
close ();
own_t::process_term (linger_);
}
void zmq::ipc_connecter_t::in_event () void zmq::ipc_connecter_t::in_event ()
{ {
// We are not polling for incomming data, so we are actually called // We are not polling for incomming data, so we are actually called

View File

@ -55,6 +55,7 @@ namespace zmq
// Handlers for incoming commands. // Handlers for incoming commands.
void process_plug (); void process_plug ();
void process_term (int linger_);
// Handlers for I/O events. // Handlers for I/O events.
void in_event (); void in_event ();

View File

@ -52,8 +52,7 @@ zmq::ipc_listener_t::ipc_listener_t (io_thread_t *io_thread_,
zmq::ipc_listener_t::~ipc_listener_t () zmq::ipc_listener_t::~ipc_listener_t ()
{ {
if (s != retired_fd) zmq_assert (s == retired_fd);
close ();
} }
void zmq::ipc_listener_t::process_plug () void zmq::ipc_listener_t::process_plug ()

View File

@ -68,13 +68,9 @@ zmq::tcp_connecter_t::tcp_connecter_t (class io_thread_t *io_thread_,
zmq::tcp_connecter_t::~tcp_connecter_t () zmq::tcp_connecter_t::~tcp_connecter_t ()
{ {
if (wait) zmq_assert (!wait);
cancel_timer (reconnect_timer_id); zmq_assert (!handle_valid);
if (handle_valid) zmq_assert (s == retired_fd);
rm_fd (handle);
if (s != retired_fd)
close ();
} }
void zmq::tcp_connecter_t::process_plug () void zmq::tcp_connecter_t::process_plug ()
@ -85,6 +81,24 @@ void zmq::tcp_connecter_t::process_plug ()
start_connecting (); start_connecting ();
} }
void zmq::tcp_connecter_t::process_term (int linger_)
{
if (wait) {
cancel_timer (reconnect_timer_id);
wait = false;
}
if (handle_valid) {
rm_fd (handle);
handle_valid = false;
}
if (s != retired_fd)
close ();
own_t::process_term (linger_);
}
void zmq::tcp_connecter_t::in_event () void zmq::tcp_connecter_t::in_event ()
{ {
// We are not polling for incomming data, so we are actually called // We are not polling for incomming data, so we are actually called

View File

@ -53,6 +53,7 @@ namespace zmq
// Handlers for incoming commands. // Handlers for incoming commands.
void process_plug (); void process_plug ();
void process_term (int linger_);
// Handlers for I/O events. // Handlers for I/O events.
void in_event (); void in_event ();

View File

@ -60,8 +60,7 @@ zmq::tcp_listener_t::tcp_listener_t (io_thread_t *io_thread_,
zmq::tcp_listener_t::~tcp_listener_t () zmq::tcp_listener_t::~tcp_listener_t ()
{ {
if (s != retired_fd) zmq_assert (s == retired_fd);
close ();
} }
void zmq::tcp_listener_t::process_plug () void zmq::tcp_listener_t::process_plug ()