summaryrefslogtreecommitdiff
path: root/evport.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-01-01 21:17:31 -0500
committerNick Mathewson <nickm@torproject.org>2011-01-01 21:17:31 -0500
commitb42ce4bf08c8e70bf6b357d4e2e95885fff0d530 (patch)
tree5cdf1c4bf59848a3fc50f00bfcdb8181e0423767 /evport.c
parent05f0195dd94fa8a84a2006bda8900f5f6b30cd40 (diff)
downloadlibevent-b42ce4bf08c8e70bf6b357d4e2e95885fff0d530.tar.gz
Fix evport handling of POLLHUP and POLLERR
In other backends, they make _all_ events trigger; with evport they previously triggered nothing. Found by Phua Keat Yee.
Diffstat (limited to 'evport.c')
-rw-r--r--evport.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/evport.c b/evport.c
index 4301a39c..9ad2289b 100644
--- 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]);