Clean-up of session termination process

Specifically, shutdown of child objects is initiated *before* termination
handshake with socket object.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik
2010-10-08 17:23:21 +02:00
parent 965fb7755b
commit 7a685b0f88
10 changed files with 99 additions and 68 deletions

View File

@@ -89,6 +89,11 @@ bool zmq::reader_t::check_read ()
// If the next item in the pipe is message delimiter,
// initiate its termination.
if (pipe->probe (is_delimiter)) {
zmq_msg_t msg;
bool ok = pipe->read (&msg);
zmq_assert (ok);
if (sink)
sink->delimited (this);
terminate ();
return false;
}
@@ -109,6 +114,8 @@ bool zmq::reader_t::read (zmq_msg_t *msg_)
// If delimiter was read, start termination process of the pipe.
unsigned char *offset = 0;
if (msg_->content == (void*) (offset + ZMQ_DELIMITER)) {
if (sink)
sink->delimited (this);
terminate ();
return false;
}