]> granicus.if.org Git - libevent/commitdiff
Merge branch '20_evport_pollhup' into patches-2.0
authorNick Mathewson <nickm@torproject.org>
Sun, 13 Feb 2011 07:51:27 +0000 (02:51 -0500)
committerNick Mathewson <nickm@torproject.org>
Sun, 13 Feb 2011 07:51:27 +0000 (02:51 -0500)
1  2 
evport.c

diff --cc evport.c
index e77f2b2992ae5acdcab08b281476786c85143539,9ad2289b4ce40375c5ebe05712e2cfd1fbd504d9..f1da73d5671ea4232b962b58af6a451d646004f0
+++ b/evport.c
@@@ -336,17 -336,15 +336,21 @@@ evport_dispatch(struct event_base *base
                 * (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;
+               }
  
 +              /*
 +               * Check for the error situations or a hangup situation
 +               */
 +              if (pevt->portev_events & (POLLERR|POLLHUP|POLLNVAL))
 +                      res |= EV_READ|EV_WRITE;
 +
                EVUTIL_ASSERT(epdp->ed_nevents > fd);
                fdi = &(epdp->ed_fds[fd]);