summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-09-20 17:25:04 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-09-20 17:25:04 +0200
commit4d51a52874b814f65a31a0c1b8e0a36cb671697c (patch)
treebc242904fde02295cf9de254d767d03f80bffc80
parentf49b77eedcdacf9663050a20723ac964af7cdac0 (diff)
zmq_poll (select version) now correctly assumes that ZMQ_FD is edge-trigerred
-rw-r--r--src/zmq.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/zmq.cpp b/src/zmq.cpp
index 7d9424f..87bd6c5 100644
--- a/src/zmq.cpp
+++ b/src/zmq.cpp
@@ -569,24 +569,17 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
// The poll item is a 0MQ socket. Retrieve pending events
// using the ZMQ_EVENTS socket option.
if (items_ [i].socket) {
- size_t zmq_fd_size = sizeof (zmq::fd_t);
- zmq::fd_t notify_fd;
- if (zmq_getsockopt (items_ [i].socket, ZMQ_FD, &notify_fd,
- &zmq_fd_size) == -1)
+ size_t zmq_events_size = sizeof (uint32_t);
+ uint32_t zmq_events;
+ if (zmq_getsockopt (items_ [i].socket, ZMQ_EVENTS, &zmq_events,
+ &zmq_events_size) == -1)
return -1;
- if (FD_ISSET (notify_fd, &inset)) {
- size_t zmq_events_size = sizeof (uint32_t);
- uint32_t zmq_events;
- if (zmq_getsockopt (items_ [i].socket, ZMQ_EVENTS, &zmq_events,
- &zmq_events_size) == -1)
- return -1;
- if ((items_ [i].events & ZMQ_POLLOUT) &&
- (zmq_events & ZMQ_POLLOUT))
- items_ [i].revents |= ZMQ_POLLOUT;
- if ((items_ [i].events & ZMQ_POLLIN) &&
- (zmq_events & ZMQ_POLLIN))
- items_ [i].revents |= ZMQ_POLLIN;
- }
+ if ((items_ [i].events & ZMQ_POLLOUT) &&
+ (zmq_events & ZMQ_POLLOUT))
+ items_ [i].revents |= ZMQ_POLLOUT;
+ if ((items_ [i].events & ZMQ_POLLIN) &&
+ (zmq_events & ZMQ_POLLIN))
+ items_ [i].revents |= ZMQ_POLLIN;
}
// Else, the poll item is a raw file descriptor, simply convert
// the events to zmq_pollitem_t-style format.