mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 10:52:56 +01:00
Filter read and write activated calls from the pipe to the session, and delay shutdown in terminated until the final pipe is shutdown.
This commit is contained in:
parent
a5f7300da6
commit
a90c1db7d2
@ -233,11 +233,17 @@ void zmq::session_base_t::terminated (pipe_t *pipe_)
|
|||||||
// Drop the reference to the deallocated pipe if required.
|
// Drop the reference to the deallocated pipe if required.
|
||||||
zmq_assert (pipe == pipe_ || incomplete_detach > 0);
|
zmq_assert (pipe == pipe_ || incomplete_detach > 0);
|
||||||
|
|
||||||
|
// If we still have pipes outstanding, decrement.
|
||||||
|
// This will only have been set in a disconnect situation
|
||||||
|
// where delay_attach_on_connect is 1.
|
||||||
if (incomplete_detach > 0)
|
if (incomplete_detach > 0)
|
||||||
incomplete_detach --;
|
incomplete_detach --;
|
||||||
|
|
||||||
if ( incomplete_detach == 0 )
|
// If there are still extra detached pipes, don't continue
|
||||||
pipe = NULL;
|
if (incomplete_detach > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pipe = NULL;
|
||||||
|
|
||||||
// If we are waiting for pending messages to be sent, at this point
|
// If we are waiting for pending messages to be sent, at this point
|
||||||
// we are sure that there will be no more messages and we can proceed
|
// we are sure that there will be no more messages and we can proceed
|
||||||
@ -248,6 +254,10 @@ void zmq::session_base_t::terminated (pipe_t *pipe_)
|
|||||||
|
|
||||||
void zmq::session_base_t::read_activated (pipe_t *pipe_)
|
void zmq::session_base_t::read_activated (pipe_t *pipe_)
|
||||||
{
|
{
|
||||||
|
// Skip activating if we're detaching this pipe
|
||||||
|
if (incomplete_detach > 0 && pipe_ != pipe)
|
||||||
|
return;
|
||||||
|
|
||||||
zmq_assert (pipe == pipe_);
|
zmq_assert (pipe == pipe_);
|
||||||
|
|
||||||
if (likely (engine != NULL))
|
if (likely (engine != NULL))
|
||||||
@ -258,6 +268,10 @@ void zmq::session_base_t::read_activated (pipe_t *pipe_)
|
|||||||
|
|
||||||
void zmq::session_base_t::write_activated (pipe_t *pipe_)
|
void zmq::session_base_t::write_activated (pipe_t *pipe_)
|
||||||
{
|
{
|
||||||
|
// Skip activating if we're detaching this pipe
|
||||||
|
if (incomplete_detach > 0 && pipe_ != pipe)
|
||||||
|
return;
|
||||||
|
|
||||||
zmq_assert (pipe == pipe_);
|
zmq_assert (pipe == pipe_);
|
||||||
|
|
||||||
if (engine)
|
if (engine)
|
||||||
|
Loading…
Reference in New Issue
Block a user