From 86eaa9c8e753dfde77b675d25204f94080c65d92 Mon Sep 17 00:00:00 2001 From: Martin Hurton Date: Fri, 6 Jul 2012 12:17:13 +0200 Subject: [PATCH] Rewrite process_command's loop --- src/socket_base.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 60c7ceb9..2e4c2a68 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -822,16 +822,16 @@ int zmq::socket_base_t::process_commands (int timeout_, bool throttle_) rc = mailbox.recv (&cmd, 0); } - // Process all the commands available at the moment. - while (true) { - if (rc == -1 && errno == EAGAIN) - break; - if (rc == -1 && errno == EINTR) - return -1; - errno_assert (rc == 0); + // Process all available commands. + while (rc == 0) { cmd.destination->process_command (cmd); rc = mailbox.recv (&cmd, 0); - } + } + + if (errno == EINTR) + return -1; + + zmq_assert (errno == EAGAIN); if (ctx_terminated) { errno = ETERM;