- notifiers[pfd[i].fd]->activate(pfd[i].revents);
-
- if (!--ret)
- break;
- } else if (pfd[i].revents & (POLLERR|POLLHUP|POLLNVAL))
- eDebug("poll: unhandled POLLERR/HUP/NVAL for fd %d(%d)", pfd[i].fd,pfd[i].revents);
+ if (notifiers.find(pfd[i].fd) == notifiers.end())
+ continue;
+
+ int req = notifiers[pfd[i].fd]->getRequested();
+
+ if (pfd[i].revents & req)
+ {
+ notifiers[pfd[i].fd]->activate(pfd[i].revents);
+
+ if (!--ret)
+ break;
+ } else if (pfd[i].revents & (POLLERR|POLLHUP|POLLNVAL))
+ eFatal("poll: unhandled POLLERR/HUP/NVAL for fd %d(%d) -> FIX YOUR CODE", pfd[i].fd,pfd[i].revents);
+ }
+
+ ret = 1; /* poll did not timeout. */
+ } else if (ret < 0)
+ {
+ /* when we got a signal, we get EINTR. */
+ if (errno != EINTR)
+ eDebug("poll made error (%m)");
+ else
+ ret = -1; /* don't assume the timeout has passed when we got a signal */