mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-30 13:47:13 +01:00
bug in pipe deactivation fixed
This commit is contained in:
@@ -80,11 +80,8 @@ bool zmq::reader_t::check_read ()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Check if there's an item in the pipe.
|
// Check if there's an item in the pipe.
|
||||||
// If not, deactivate the pipe.
|
if (!pipe->check_read ())
|
||||||
if (!pipe->check_read ()) {
|
|
||||||
terminate ();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// If the next item in the pipe is message delimiter,
|
// If the next item in the pipe is message delimiter,
|
||||||
// initiate its termination.
|
// initiate its termination.
|
||||||
@@ -198,7 +195,8 @@ bool zmq::writer_t::check_write ()
|
|||||||
if (terminating)
|
if (terminating)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (pipe_full () && (msg_store == NULL || msg_store->full () || extra_msg_flag)) {
|
if (pipe_full () && (msg_store == NULL || msg_store->full () ||
|
||||||
|
extra_msg_flag)) {
|
||||||
stalled = true;
|
stalled = true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ int main ()
|
|||||||
{
|
{
|
||||||
const string returned = zmqtestutil::ping_pong (p, expect);
|
const string returned = zmqtestutil::ping_pong (p, expect);
|
||||||
assert (expect == returned);
|
assert (expect == returned);
|
||||||
|
|
||||||
// Adjust socket state so that poll shows only 1 pending message.
|
// Adjust socket state so that poll shows only 1 pending message.
|
||||||
zmq::message_t mx ;
|
zmq::message_t mx ;
|
||||||
p.first->recv (&mx, 0);
|
p.first->recv (&mx, 0);
|
||||||
@@ -58,8 +59,7 @@ int main ()
|
|||||||
|
|
||||||
p.first->send (m1, 0);
|
p.first->send (m1, 0);
|
||||||
|
|
||||||
// Now use polling. Timout makes test abort on error.
|
int rc = zmq::poll (&items [0], 2, -1);
|
||||||
int rc = zmq::poll (&items [0], 2, 1000);
|
|
||||||
assert (rc == 1);
|
assert (rc == 1);
|
||||||
assert ((items [1].revents & ZMQ_POLLIN) != 0);
|
assert ((items [1].revents & ZMQ_POLLIN) != 0);
|
||||||
|
|
||||||
@@ -74,4 +74,5 @@ int main ()
|
|||||||
delete (p.second);
|
delete (p.second);
|
||||||
|
|
||||||
return 0 ;
|
return 0 ;
|
||||||
|
assert (false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ int main()
|
|||||||
{
|
{
|
||||||
const string returned = zmqtestutil::ping_pong (p, expect);
|
const string returned = zmqtestutil::ping_pong (p, expect);
|
||||||
assert (expect == returned);
|
assert (expect == returned);
|
||||||
|
|
||||||
// Adjust socket state, so that first is clean for another send.
|
// Adjust socket state, so that first is clean for another send.
|
||||||
zmq::message_t mx ;
|
zmq::message_t mx ;
|
||||||
p.first->recv(&mx, 0);
|
p.first->recv(&mx, 0);
|
||||||
@@ -58,8 +59,7 @@ int main()
|
|||||||
|
|
||||||
p.first->send (m1, 0);
|
p.first->send (m1, 0);
|
||||||
|
|
||||||
// Now use polling. Timout makes test abort on error.
|
int rc = zmq::poll(&items [0], 2, -1);
|
||||||
int rc = zmq::poll(&items [0], 2, 1000);
|
|
||||||
assert (rc == 1);
|
assert (rc == 1);
|
||||||
assert ((items [1].revents & ZMQ_POLLIN) != 0);
|
assert ((items [1].revents & ZMQ_POLLIN) != 0);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user