Commit d008637b authored by Martin Sustrik's avatar Martin Sustrik

one more attempt to fix the previous win32 problem

parent f97da5e6
...@@ -350,30 +350,30 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_) ...@@ -350,30 +350,30 @@ int zmq::socket_base_t::recv (::zmq_msg_t *msg_, int flags_)
if (rc == 0) if (rc == 0)
return 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. // If the message cannot be fetched immediately, there are two scenarios.
// For non-blocking recv, commands are processed in case there's a revive // 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. // 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 (flags_ & ZMQ_NOBLOCK) {
if (errno != EAGAIN) if (errno != EAGAIN)
return -1; return -1;
app_thread->process_commands (false, false); app_thread->process_commands (false, false);
rc = xrecv (msg_, flags_);
ticks = 0; ticks = 0;
} return xrecv (msg_, flags_);
else {
while (rc != 0) {
if (errno != EAGAIN)
return -1;
app_thread->process_commands (true, false);
rc = xrecv (msg_, flags_);
ticks = 0;
}
} }
errno = err; // In blocking scenario, commands are processed over and over again until
return rc; // 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 () int zmq::socket_base_t::close ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment