diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-02-17 21:16:59 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-02-17 21:16:59 +0100 |
commit | d008637bc42da3fca50e423c2df0736be2745ac7 (patch) | |
tree | e2c541b8653ed80d93b6f7f67cae7309f16829c1 /src | |
parent | f97da5e6449b183ad3ebb9b0ba8c37ff3dc17387 (diff) |
one more attempt to fix the previous win32 problem
Diffstat (limited to 'src')
-rw-r--r-- | src/socket_base.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 6f1e5a3..ef563e5 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -350,30 +350,30 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_) if (rc == 0) return 0; + // If we don't have the message, restore the original cause of the problem. + errno = err; + // If the message cannot be fetched immediately, there are two scenarios. // For non-blocking recv, commands are processed in case there's a revive // command already waiting int a command pipe. If it's not, return EAGAIN. - // In blocking scenario, commands are processed over and over again until - // we are able to fetch a message. if (flags_ & ZMQ_NOBLOCK) { if (errno != EAGAIN) return -1; app_thread->process_commands (false, false); - rc = xrecv (msg_, flags_); ticks = 0; - } - else { - while (rc != 0) { - if (errno != EAGAIN) - return -1; - app_thread->process_commands (true, false); - rc = xrecv (msg_, flags_); - ticks = 0; - } + return xrecv (msg_, flags_); } - errno = err; - return rc; + // In blocking scenario, commands are processed over and over again until + // we are able to fetch a message. + while (rc != 0) { + if (errno != EAGAIN) + return -1; + app_thread->process_commands (true, false); + rc = xrecv (msg_, flags_); + ticks = 0; + } + return 0; } int zmq::socket_base_t::close () |