summaryrefslogtreecommitdiff
path: root/src/pipe.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-10-08 17:23:21 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-10-08 17:23:21 +0200
commit7a685b0f88386b11c4c1fcbb45324aa28f4e2eac (patch)
treee26729a4aebeb487b699a09330a8856521375d24 /src/pipe.cpp
parent965fb7755b50ca1522f076da46fa3651812126e1 (diff)
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>
Diffstat (limited to 'src/pipe.cpp')
-rw-r--r--src/pipe.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/pipe.cpp b/src/pipe.cpp
index 4551660..65e9b0b 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -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;
}