summaryrefslogtreecommitdiff
path: root/src/zmq_engine.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-02-08 10:34:12 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-02-08 10:34:12 +0100
commit7593d815ac57f2877480c5056b2f1aa65460f5c3 (patch)
tree82e9297f1ecb9f7d2a7f9d19c2c236833890d9d6 /src/zmq_engine.cpp
parent427bc3276aa236c8691fee7e634717d0579a3055 (diff)
ZMQII-64: First message stuck in 0MQ in case of immediate disconnection
Diffstat (limited to 'src/zmq_engine.cpp')
-rw-r--r--src/zmq_engine.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/zmq_engine.cpp b/src/zmq_engine.cpp
index dace6ae..01fe98c 100644
--- a/src/zmq_engine.cpp
+++ b/src/zmq_engine.cpp
@@ -81,6 +81,8 @@ void zmq::zmq_engine_t::unplug ()
void zmq::zmq_engine_t::in_event ()
{
+ bool disconnection = false;
+
// If there's no data to process in the buffer...
if (!insize) {
@@ -91,8 +93,7 @@ void zmq::zmq_engine_t::in_event ()
// Check whether the peer has closed the connection.
if (insize == (size_t) -1) {
insize = 0;
- error ();
- return;
+ disconnection = true;
}
}
@@ -114,6 +115,9 @@ void zmq::zmq_engine_t::in_event ()
// Flush all messages the decoder may have produced.
inout->flush ();
+
+ if (disconnection)
+ error ();
}
void zmq::zmq_engine_t::out_event ()