deal correctly with POLLNHUP
This commit is contained in:
parent
c53b0c7769
commit
cda395fc27
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: poll.c,v 1.3 2003/06/13 04:11:31 itojun Exp $ */
|
||||
/* $NetBSD: poll.c,v 1.4 2003/09/28 20:02:44 provos Exp $ */
|
||||
/* $OpenBSD: poll.c,v 1.2 2002/06/25 15:50:15 mickey Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -194,10 +194,13 @@ poll_dispatch(void *arg, struct timeval *tv)
|
|||
|
||||
for (i = 0; i < nfds; i++) {
|
||||
res = 0;
|
||||
/* If the file gets closed notify */
|
||||
if (pop->event_set[i].revents & POLLHUP)
|
||||
pop->event_set[i].revents = POLLIN|POLLOUT;
|
||||
if (pop->event_set[i].revents & POLLIN)
|
||||
res = EV_READ;
|
||||
else if (pop->event_set[i].revents & POLLOUT)
|
||||
res = EV_WRITE;
|
||||
res |= EV_READ;
|
||||
if (pop->event_set[i].revents & POLLOUT)
|
||||
res |= EV_WRITE;
|
||||
if (res == 0)
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue