summaryrefslogtreecommitdiff
path: root/src/pipe.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-05-31 14:36:51 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-05-31 14:36:51 +0200
commita24a7c15a824bb48da38809bff9416673dc5a176 (patch)
treef952e4d06004f2ec0683fa47b5418b8b805ea799 /src/pipe.cpp
parent0b59866a84f733e5a53b0d2f32570581691747ef (diff)
Session termination induced by socket fixed
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/pipe.cpp')
-rw-r--r--src/pipe.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/pipe.cpp b/src/pipe.cpp
index fd7223c..26f7d85 100644
--- a/src/pipe.cpp
+++ b/src/pipe.cpp
@@ -301,8 +301,11 @@ void zmq::pipe_t::process_pipe_term_ack ()
delete this;
}
-void zmq::pipe_t::terminate ()
+void zmq::pipe_t::terminate (bool delay_)
{
+ // Overload the value specified at pipe creation.
+ delay = delay_;
+
// If terminate was already called, we can ignore the duplicit invocation.
if (state == terminated || state == double_terminated)
return;
@@ -321,9 +324,13 @@ void zmq::pipe_t::terminate ()
// There are still pending messages available, but the user calls
// 'terminate'. We can act as if all the pending messages were read.
- else if (state == pending) {
- send_pipe_term_ack (peer);
- state = terminating;
+ else if (state == pending && !delay) {
+ send_pipe_term_ack (peer);
+ state = terminating;
+ }
+
+ // If there are pending messages still availabe, do nothing.
+ else if (state == pending && delay) {
}
// We've already got delimiter, but not term command yet. We can ignore
@@ -338,8 +345,7 @@ void zmq::pipe_t::terminate ()
else
zmq_assert (false);
- // Stop inbound and outbound flow of messages.
- in_active = false;
+ // Stop outbound flow of messages.
out_active = false;
// Rollback any unfinished outbound messages.