mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-04 04:55:27 +08:00
polling on POSIX sockets returns POLLERR (win32)
This commit is contained in:
parent
4e7158b67d
commit
157a66fc42
12
src/zmq.cpp
12
src/zmq.cpp
@ -504,6 +504,8 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
|
|||||||
FD_SET (items_ [i].fd, &pollset_in);
|
FD_SET (items_ [i].fd, &pollset_in);
|
||||||
if (items_ [i].events & ZMQ_POLLOUT)
|
if (items_ [i].events & ZMQ_POLLOUT)
|
||||||
FD_SET (items_ [i].fd, &pollset_out);
|
FD_SET (items_ [i].fd, &pollset_out);
|
||||||
|
if (items_ [i].events & ZMQ_POLLERR)
|
||||||
|
FD_SET (items_ [i].fd, &pollset_err);
|
||||||
if (maxfd == zmq::retired_fd || maxfd < items_ [i].fd)
|
if (maxfd == zmq::retired_fd || maxfd < items_ [i].fd)
|
||||||
maxfd = items_ [i].fd;
|
maxfd = items_ [i].fd;
|
||||||
}
|
}
|
||||||
@ -554,9 +556,13 @@ int zmq_poll (zmq_pollitem_t *items_, int nitems_, long timeout_)
|
|||||||
// If the poll item is a raw file descriptor, simply convert
|
// If the poll item is a raw file descriptor, simply convert
|
||||||
// the events to zmq_pollitem_t-style format.
|
// the events to zmq_pollitem_t-style format.
|
||||||
if (!items_ [i].socket) {
|
if (!items_ [i].socket) {
|
||||||
items_ [i].revents =
|
items_ [i].revents = 0;
|
||||||
(FD_ISSET (items_ [i].fd, &inset) ? ZMQ_POLLIN : 0) |
|
if (FD_ISSET (items_ [i].fd, &inset))
|
||||||
(FD_ISSET (items_ [i].fd, &outset) ? ZMQ_POLLOUT : 0);
|
items_ [i].revents |= ZMQ_POLLIN;
|
||||||
|
if (FD_ISSET (items_ [i].fd, &outset))
|
||||||
|
items_ [i].revents |= ZMQ_POLLOUT;
|
||||||
|
if (FD_ISSET (items_ [i].fd, &errset))
|
||||||
|
items_ [i].revents |= ZMQ_POLLERR;
|
||||||
if (items_ [i].revents)
|
if (items_ [i].revents)
|
||||||
nevents++;
|
nevents++;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user