From daf5d3273b1930af7e4c54ee597b89ecb3763000 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Fri, 8 Oct 2010 21:42:55 +0200 Subject: More cleanup of session termination process. Fix in termination of session attached to a REP socket. Several fixes of session termination in case of disconnection. Signed-off-by: Martin Sustrik --- src/session.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/session.cpp') diff --git a/src/session.cpp b/src/session.cpp index f39cf05..c926e63 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -24,6 +24,7 @@ #include "i_engine.hpp" #include "err.hpp" #include "pipe.hpp" +#include "likely.hpp" zmq::session_t::session_t (class io_thread_t *io_thread_, class socket_base_t *socket_, const options_t &options_) : @@ -181,8 +182,10 @@ void zmq::session_t::activated (reader_t *pipe_) { zmq_assert (in_pipe == pipe_); - if (engine) + if (likely (engine != NULL)) engine->activate_out (); + else + in_pipe->check_read (); } void zmq::session_t::activated (writer_t *pipe_) @@ -267,7 +270,8 @@ void zmq::session_t::process_term () // inbound pipe, but the delimiter was already processed, we can // terminate immediately. Alternatively, if the derived session type have // called 'terminate' we'll finish straight away. - if (!options.requires_out || delimiter_processed || force_terminate) + if (!options.requires_out || delimiter_processed || force_terminate || + (!options.immediate_connect && !in_pipe)) proceed_with_term (); } @@ -287,6 +291,8 @@ void zmq::session_t::attached (const blob_t &peer_identity_) void zmq::session_t::detached () { + if (in_pipe) + in_pipe->check_read (); } void zmq::session_t::terminate () -- cgit v1.2.3