Merge branch 'maint'

* maint:
  Fix socket_t::recv() hang scenario where initial call to process_commands() eats signal

Conflicts:
	src/socket_base.cpp
This commit is contained in:
Martin Sustrik 2010-11-12 14:47:26 +01:00
commit 8abe67357a
2 changed files with 4 additions and 1 deletions

View File

@ -26,6 +26,7 @@ Jacob Rideout <jacob.rideout@returnpath.net>
Joe Thornber <joe.thornber@gmail.com> Joe Thornber <joe.thornber@gmail.com>
Jon Dyte <jon@totient.co.uk> Jon Dyte <jon@totient.co.uk>
Kamil Shakirov <kamils80@gmail.com> Kamil Shakirov <kamils80@gmail.com>
Marc Rossi <mrossi19@gmail.com>
Martin Hurton <hurtonm@gmail.com> Martin Hurton <hurtonm@gmail.com>
Martin Lucina <mato@kotelna.sk> Martin Lucina <mato@kotelna.sk>
Martin Pales <m.pales@gmail.com> Martin Pales <m.pales@gmail.com>

View File

@ -519,13 +519,15 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
// In blocking scenario, commands are processed over and over again until // In blocking scenario, commands are processed over and over again until
// we are able to fetch a message. // we are able to fetch a message.
bool block = (ticks != 0);
while (rc != 0) { while (rc != 0) {
if (errno != EAGAIN) if (errno != EAGAIN)
return -1; return -1;
if (unlikely (process_commands (true, false) != 0)) if (unlikely (process_commands (block, false) != 0))
return -1; return -1;
rc = xrecv (msg_, flags_); rc = xrecv (msg_, flags_);
ticks = 0; ticks = 0;
block = true;
} }
rcvmore = msg_->flags & ZMQ_MSG_MORE; rcvmore = msg_->flags & ZMQ_MSG_MORE;