]> granicus.if.org Git - libevent/commitdiff
Fix evport handling of POLLHUP and POLLERR
authorNick Mathewson <nickm@torproject.org>
Sun, 2 Jan 2011 02:17:31 +0000 (21:17 -0500)
committerNick Mathewson <nickm@torproject.org>
Sun, 2 Jan 2011 02:17:31 +0000 (21:17 -0500)
In other backends, they make _all_ events trigger; with evport they
previously triggered nothing.  Found by Phua Keat Yee.

evport.c

index 4301a39c7f3213ea81664ad97ade568fbb2be725..9ad2289b4ce40375c5ebe05712e2cfd1fbd504d9 100644 (file)
--- a/evport.c
+++ b/evport.c
@@ -336,10 +336,14 @@ evport_dispatch(struct event_base *base, struct timeval *tv)
                 * (because we have to pass this to the callback)
                 */
                res = 0;
-               if (pevt->portev_events & POLLIN)
-                       res |= EV_READ;
-               if (pevt->portev_events & POLLOUT)
-                       res |= EV_WRITE;
+               if (pevt->portev_events & (POLLERR|POLLHUP)) {
+                       res = EV_READ | EV_WRITE;
+               } else {
+                       if (pevt->portev_events & POLLIN)
+                               res |= EV_READ;
+                       if (pevt->portev_events & POLLOUT)
+                               res |= EV_WRITE;
+               }
 
                EVUTIL_ASSERT(epdp->ed_nevents > fd);
                fdi = &(epdp->ed_fds[fd]);