X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libevent%2Fevport.c;h=f1da73d5671ea4232b962b58af6a451d646004f0;hb=75cceac7017a24e33d65f917155ad0d8b15ef178;hp=4301a39c7f3213ea81664ad97ade568fbb2be725;hpb=b0bcb8f6b0571592a50ce039882c9319e012a270;p=netatalk.git diff --git a/libevent/evport.c b/libevent/evport.c index 4301a39c..f1da73d5 100644 --- a/libevent/evport.c +++ b/libevent/evport.c @@ -336,10 +336,20 @@ 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; + } + + /* + * 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]);