summaryrefslogtreecommitdiff
path: root/src/zmq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zmq.cpp')
-rw-r--r--src/zmq.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 85f7d62..dce9630 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -412,7 +412,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
Sleep (timeout_ > 0 ? timeout_ / 1000 : INFINITE);
return 0;
#else
- return usleep (timeout_);
+ usleep (timeout_);
+ return 0;
#endif
}
@@ -565,7 +566,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
Sleep (timeout_ > 0 ? timeout_ / 1000 : INFINITE);
return 0;
#else
- return usleep (timeout_);
+ usleep (timeout_);
+ return 0;
#endif
}
@@ -649,13 +651,21 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
memcpy (&inset, &pollset_in, sizeof (fd_set));
memcpy (&outset, &pollset_out, sizeof (fd_set));
memcpy (&errset, &pollset_err, sizeof (fd_set));
- int rc = select (maxfd + 1, &inset, &outset, &errset, ptimeout);
#if defined ZMQ_HAVE_WINDOWS
- wsa_assert (rc != SOCKET_ERROR);
+ int rc = select (0, &inset, &outset, &errset, ptimeout);
+ if (unlikely (rc == SOCKET_ERROR)) {
+ zmq::wsa_error_to_errno ();
+ if (errno == ENOTSOCK)
+ return -1;
+ wsa_assert (false);
+ }
#else
- if (rc == -1 && errno == EINTR)
- return -1;
- errno_assert (rc >= 0);
+ int rc = select (maxfd + 1, &inset, &outset, &errset, ptimeout);
+ if (unlikely (rc == -1) {
+ if (errno == EINTR || errno == EBADF)
+ return -1;
+ errno_assert (false);
+ }
#endif
break;
}