From 1afed1d32e20dc004cdb35cdd785b499279ebedb Mon Sep 17 00:00:00 2001 From: Patrik Wenger Date: Wed, 13 Apr 2016 02:59:15 +0200 Subject: [PATCH 1/2] Problem: tabs instead of spaces used for indentation Solution: correct it to spaces --- src/socket_poller.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/socket_poller.cpp b/src/socket_poller.cpp index d4345853..09a9a534 100644 --- a/src/socket_poller.cpp +++ b/src/socket_poller.cpp @@ -393,10 +393,10 @@ int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *event_, long time #if defined ZMQ_POLL_BASED_ON_POLL if (unlikely (poll_size == 0)) { - // We'll report an error (timed out) as if the list was non-empty and - // no event occured within the specified timeout. Otherwise the caller - // needs to check the return value AND the event to avoid using the - // nullified event data. + // We'll report an error (timed out) as if the list was non-empty and + // no event occured within the specified timeout. Otherwise the caller + // needs to check the return value AND the event to avoid using the + // nullified event data. errno = ETIMEDOUT; if (timeout_ == 0) return -1; From ba9a559fe57c0edd5dce5ee2830651b6a7842e85 Mon Sep 17 00:00:00 2001 From: Patrik Wenger Date: Wed, 13 Apr 2016 02:59:59 +0200 Subject: [PATCH 2/2] Problem: PR #1891 wasn't complete Solution: make the same change for the ZMQ_POLL_BASED_ON_SELECT case --- src/socket_poller.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/socket_poller.cpp b/src/socket_poller.cpp index 09a9a534..fa5a7f99 100644 --- a/src/socket_poller.cpp +++ b/src/socket_poller.cpp @@ -528,13 +528,19 @@ int zmq::socket_poller_t::wait (zmq::socket_poller_t::event_t *event_, long time #elif defined ZMQ_POLL_BASED_ON_SELECT if (unlikely (poll_size == 0)) { + // We'll report an error (timed out) as if the list was non-empty and + // no event occured within the specified timeout. Otherwise the caller + // needs to check the return value AND the event to avoid using the + // nullified event data. + errno = ETIMEDOUT; if (timeout_ == 0) - return 0; + return -1; #if defined ZMQ_HAVE_WINDOWS Sleep (timeout_ > 0 ? timeout_ : INFINITE); - return 0; + return -1; #else - return usleep (timeout_ * 1000); + usleep (timeout_ * 1000); + return -1; #endif } zmq::clock_t clock;