From: Nick Mathewson Date: Sun, 13 Feb 2011 07:51:27 +0000 (-0500) Subject: Merge branch '20_evport_pollhup' into patches-2.0 X-Git-Tag: release-2.0.11-stable~63 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c9be76804608dbff0bd8d4b96c633f4780437cf;p=libevent Merge branch '20_evport_pollhup' into patches-2.0 --- 0c9be76804608dbff0bd8d4b96c633f4780437cf diff --cc evport.c index e77f2b29,9ad2289b..f1da73d5 --- a/evport.c +++ 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]);