mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 05:48:51 -04:00
fixes to handle error cases by Anatoly Vorobey at pobox.com
svn:r90
This commit is contained in:
parent
d780375fc4
commit
e1cd86d73e
10
epoll.c
10
epoll.c
@ -195,11 +195,17 @@ epoll_dispatch(void *arg, struct timeval *tv)
|
||||
LOG_DBG((LOG_MISC, 80, "%s: epoll_wait reports %d", __func__, res));
|
||||
|
||||
for (i = 0; i < res; i++) {
|
||||
int which = 0, what;
|
||||
int which = 0;
|
||||
int what = events[i].events;
|
||||
struct event *evread = NULL, *evwrite = NULL;
|
||||
|
||||
evep = (struct evepoll *)events[i].data.ptr;
|
||||
what = events[i].events;
|
||||
|
||||
if (what & EPOLLHUP)
|
||||
what |= EPOLLIN | EPOLLOUT;
|
||||
else if (what & EPOLLERR)
|
||||
what |= EPOLLIN | EPOLLOUT;
|
||||
|
||||
if (what & EPOLLIN) {
|
||||
evread = evep->evread;
|
||||
which |= EV_READ;
|
||||
|
13
poll.c
13
poll.c
@ -189,13 +189,18 @@ poll_dispatch(void *arg, struct timeval *tv)
|
||||
return (0);
|
||||
|
||||
for (i = 0; i < nfds; i++) {
|
||||
int what = pop->event_set[i].revents;
|
||||
|
||||
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)
|
||||
if (what & POLLHUP)
|
||||
what |= POLLIN|POLLOUT;
|
||||
if (what & POLLERR)
|
||||
what |= POLLIN|POLLOUT;
|
||||
if (what & POLLIN)
|
||||
res |= EV_READ;
|
||||
if (pop->event_set[i].revents & POLLOUT)
|
||||
if (what & POLLOUT)
|
||||
res |= EV_WRITE;
|
||||
if (res == 0)
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user