mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
bug in pipe deactivation fixed
This commit is contained in:
parent
035c937ee7
commit
92923cd40b
@ -80,11 +80,8 @@ bool zmq::reader_t::check_read ()
|
||||
return false;
|
||||
|
||||
// Check if there's an item in the pipe.
|
||||
// If not, deactivate the pipe.
|
||||
if (!pipe->check_read ()) {
|
||||
terminate ();
|
||||
if (!pipe->check_read ())
|
||||
return false;
|
||||
}
|
||||
|
||||
// If the next item in the pipe is message delimiter,
|
||||
// initiate its termination.
|
||||
@ -198,7 +195,8 @@ bool zmq::writer_t::check_write ()
|
||||
if (terminating)
|
||||
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;
|
||||
return false;
|
||||
}
|
||||
|
@ -244,7 +244,7 @@ int zmq::socket_base_t::getsockopt (int option_, void *optval_,
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
process_commands(false, false);
|
||||
process_commands (false, false);
|
||||
*((uint32_t*) optval_) = 0;
|
||||
if (has_out ())
|
||||
*((uint32_t*) optval_) |= ZMQ_POLLOUT;
|
||||
|
@ -39,9 +39,10 @@ int main ()
|
||||
{
|
||||
const string returned = zmqtestutil::ping_pong (p, expect);
|
||||
assert (expect == returned);
|
||||
|
||||
// Adjust socket state so that poll shows only 1 pending message.
|
||||
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);
|
||||
|
||||
// Now use polling. Timout makes test abort on error.
|
||||
int rc = zmq::poll (&items [0], 2, 1000);
|
||||
int rc = zmq::poll (&items [0], 2, -1);
|
||||
assert (rc == 1);
|
||||
assert ((items [1].revents & ZMQ_POLLIN) != 0);
|
||||
|
||||
@ -74,4 +74,5 @@ int main ()
|
||||
delete (p.second);
|
||||
|
||||
return 0 ;
|
||||
assert (false);
|
||||
}
|
||||
|
@ -39,6 +39,7 @@ int main()
|
||||
{
|
||||
const string returned = zmqtestutil::ping_pong (p, expect);
|
||||
assert (expect == returned);
|
||||
|
||||
// Adjust socket state, so that first is clean for another send.
|
||||
zmq::message_t mx ;
|
||||
p.first->recv(&mx, 0);
|
||||
@ -58,8 +59,7 @@ int main()
|
||||
|
||||
p.first->send (m1, 0);
|
||||
|
||||
// Now use polling. Timout makes test abort on error.
|
||||
int rc = zmq::poll(&items [0], 2, 1000);
|
||||
int rc = zmq::poll(&items [0], 2, -1);
|
||||
assert (rc == 1);
|
||||
assert ((items [1].revents & ZMQ_POLLIN) != 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user