mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 02:42:58 +01:00
ZMQII-64: First message stuck in 0MQ in case of immediate disconnection
This commit is contained in:
parent
427bc3276a
commit
7593d815ac
@ -81,6 +81,8 @@ void zmq::zmq_engine_t::unplug ()
|
|||||||
|
|
||||||
void zmq::zmq_engine_t::in_event ()
|
void zmq::zmq_engine_t::in_event ()
|
||||||
{
|
{
|
||||||
|
bool disconnection = false;
|
||||||
|
|
||||||
// If there's no data to process in the buffer...
|
// If there's no data to process in the buffer...
|
||||||
if (!insize) {
|
if (!insize) {
|
||||||
|
|
||||||
@ -91,8 +93,7 @@ void zmq::zmq_engine_t::in_event ()
|
|||||||
// Check whether the peer has closed the connection.
|
// Check whether the peer has closed the connection.
|
||||||
if (insize == (size_t) -1) {
|
if (insize == (size_t) -1) {
|
||||||
insize = 0;
|
insize = 0;
|
||||||
error ();
|
disconnection = true;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +115,9 @@ void zmq::zmq_engine_t::in_event ()
|
|||||||
|
|
||||||
// Flush all messages the decoder may have produced.
|
// Flush all messages the decoder may have produced.
|
||||||
inout->flush ();
|
inout->flush ();
|
||||||
|
|
||||||
|
if (disconnection)
|
||||||
|
error ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmq::zmq_engine_t::out_event ()
|
void zmq::zmq_engine_t::out_event ()
|
||||||
|
Loading…
Reference in New Issue
Block a user