mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-07 22:40:55 +01:00
Rewrite process_command's loop
This commit is contained in:
@@ -822,17 +822,17 @@ int zmq::socket_base_t::process_commands (int timeout_, bool throttle_)
|
|||||||
rc = mailbox.recv (&cmd, 0);
|
rc = mailbox.recv (&cmd, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Process all the commands available at the moment.
|
// Process all available commands.
|
||||||
while (true) {
|
while (rc == 0) {
|
||||||
if (rc == -1 && errno == EAGAIN)
|
|
||||||
break;
|
|
||||||
if (rc == -1 && errno == EINTR)
|
|
||||||
return -1;
|
|
||||||
errno_assert (rc == 0);
|
|
||||||
cmd.destination->process_command (cmd);
|
cmd.destination->process_command (cmd);
|
||||||
rc = mailbox.recv (&cmd, 0);
|
rc = mailbox.recv (&cmd, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errno == EINTR)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
zmq_assert (errno == EAGAIN);
|
||||||
|
|
||||||
if (ctx_terminated) {
|
if (ctx_terminated) {
|
||||||
errno = ETERM;
|
errno = ETERM;
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user