| Index: third_party/libevent/epoll.c
|
| diff --git a/third_party/libevent/epoll.c b/third_party/libevent/epoll.c
|
| index 3a445781d0ae3546c4300177e149b601dabe303c..bfb3140eca5e8b8a908f307e7b3fae8722104300 100644
|
| --- a/third_party/libevent/epoll.c
|
| +++ b/third_party/libevent/epoll.c
|
| @@ -75,7 +75,7 @@ static int epoll_del (void *, struct event *);
|
| static int epoll_dispatch (struct event_base *, void *, struct timeval *);
|
| static void epoll_dealloc (struct event_base *, void *);
|
|
|
| -struct eventop epollops = {
|
| +const struct eventop epollops = {
|
| "epoll",
|
| epoll_init,
|
| epoll_add,
|
| @@ -166,7 +166,7 @@ epoll_recalc(struct event_base *base, void *arg, int max)
|
| {
|
| struct epollop *epollop = arg;
|
|
|
| - if (max > epollop->nfds) {
|
| + if (max >= epollop->nfds) {
|
| struct evepoll *fds;
|
| int nfds;
|
|
|
| @@ -224,8 +224,11 @@ epoll_dispatch(struct event_base *base, void *arg, struct timeval *tv)
|
| for (i = 0; i < res; i++) {
|
| int what = events[i].events;
|
| struct event *evread = NULL, *evwrite = NULL;
|
| + int fd = events[i].data.fd;
|
|
|
| - evep = (struct evepoll *)events[i].data.ptr;
|
| + if (fd < 0 && fd >= epollop->nfds)
|
| + continue;
|
| + evep = &epollop->fds[fd];
|
|
|
| if (what & (EPOLLHUP|EPOLLERR)) {
|
| evread = evep->evread;
|
| @@ -287,7 +290,7 @@ epoll_add(void *arg, struct event *ev)
|
| if (ev->ev_events & EV_WRITE)
|
| events |= EPOLLOUT;
|
|
|
| - epev.data.ptr = evep;
|
| + epev.data.fd = fd;
|
| epev.events = events;
|
| if (epoll_ctl(epollop->epfd, op, ev->ev_fd, &epev) == -1)
|
| return (-1);
|
| @@ -339,7 +342,7 @@ epoll_del(void *arg, struct event *ev)
|
| }
|
|
|
| epev.events = events;
|
| - epev.data.ptr = evep;
|
| + epev.data.fd = fd;
|
|
|
| if (needreaddelete)
|
| evep->evread = NULL;
|
|
|