summaryrefslogtreecommitdiff
path: root/epoll.c
diff options
context:
space:
mode:
authorAzat Khuzhin <azat@libevent.org>2020-05-05 00:21:18 +0300
committerAzat Khuzhin <azat@libevent.org>2020-05-05 00:25:23 +0300
commit972b456bf60e9a2f550ec45a14921c06e252c793 (patch)
tree1a2618212597dd1f9919f68a22612564320ed7d1 /epoll.c
parentc10cde4c617979e951352775a9685a47bf9c6acd (diff)
downloadlibevent-972b456bf60e9a2f550ec45a14921c06e252c793.tar.gz
Fix EV_CLOSED detection/reporting (epoll only)
- EV_CLOSED is EPOLLRDHUP in epoll - EPOLLRDHUP reported w/o EPOLLHUP if the socket closed with shutdown(SHUT_WR) - EPOLLRDHUP reported w/ EPOLLHUP if the socket closed with close() so in this case epoll backend will detect this event as error (EV_READ|EV_WRITE), since the epoll_ctl() will return EPOLLRDHUP with EPOLLHUP set, but this is not correct, let's fix this. Fixes: #984
Diffstat (limited to 'epoll.c')
-rw-r--r--epoll.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/epoll.c b/epoll.c
index 299e3d35..4b1e3963 100644
--- a/epoll.c
+++ b/epoll.c
@@ -487,7 +487,9 @@ epoll_dispatch(struct event_base *base, struct timeval *tv)
continue;
#endif
- if (what & (EPOLLHUP|EPOLLERR)) {
+ if (what & EPOLLERR) {
+ ev = EV_READ | EV_WRITE;
+ } else if ((what & EPOLLHUP) && !(what & EPOLLRDHUP)) {
ev = EV_READ | EV_WRITE;
} else {
if (what & EPOLLIN)