summaryrefslogtreecommitdiff
path: root/src/zmq.cpp
diff options
context:
space:
mode:
authorMartin Lucina <mato@kotelna.sk>2011-09-08 16:38:46 +0200
committerMartin Lucina <martin@lucina.net>2012-01-23 08:54:16 +0100
commit88f712b4a31c95caef4f34c4ec65793c392314a6 (patch)
tree2f17936ce9d53b1b13908e8d4288846aaa604263 /src/zmq.cpp
parentad3e013f74d309b86e8f087932203e5787fe2d2d (diff)
parent75af6aed482ab16997c1388fe801f74d11ec12a4 (diff)
Imported Debian patch 2.1.9-1debian/2.1.9-1
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;
}