summaryrefslogtreecommitdiff
path: root/src/session.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-08-06 20:55:37 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-08-25 15:39:20 +0200
commitf77edfce26bf50ab6eae6550d33f345c9785acca (patch)
tree5032230e78bf21451f1a6e1643140734f0fada15 /src/session.cpp
parent05d908492dc382941fc633ad7082b5bd86e84e67 (diff)
Destruction of session is delayed till both in & out pipes are closed
Diffstat (limited to 'src/session.cpp')
-rw-r--r--src/session.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/session.cpp b/src/session.cpp
index 86086fb..3c74898 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -71,7 +71,8 @@ zmq::session_t::~session_t ()
bool zmq::session_t::is_terminable ()
{
- return in_pipe->is_terminating ();
+ // The session won't send term_ack until both in & out pipe are closed.
+ return !in_pipe && !out_pipe;
}
bool zmq::session_t::read (::zmq_msg_t *msg_)
@@ -81,8 +82,6 @@ bool zmq::session_t::read (::zmq_msg_t *msg_)
if (!in_pipe->read (msg_)) {
active = false;
- if (in_pipe->is_terminating ())
- finalise ();
return false;
}
@@ -179,11 +178,13 @@ void zmq::session_t::terminated (reader_t *pipe_)
{
active = false;
in_pipe = NULL;
+ finalise ();
}
void zmq::session_t::terminated (writer_t *pipe_)
{
out_pipe = NULL;
+ finalise ();
}
void zmq::session_t::activated (reader_t *pipe_)