eloop: remove fd from epoll-set on HUP
If a handler does not correctly remove itself on HUP, the epoll-loop will never sleep again because the fd will always be notified as HUP. Therefore, remove the fd from the epoll-set directly on HUP. This doesn't change application behavior so it is safe here. This also allows other subsystems to ignore HUP/ERR events if they are not fatal. The FD won't be readded but that may not bother. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
56659ce429
commit
563492a0c8
@ -798,10 +798,12 @@ int ev_eloop_dispatch(struct ev_eloop *loop, int timeout)
|
||||
mask |= EV_READABLE;
|
||||
if (ep[i].events & EPOLLOUT)
|
||||
mask |= EV_WRITEABLE;
|
||||
if (ep[i].events & EPOLLHUP)
|
||||
mask |= EV_HUP;
|
||||
if (ep[i].events & EPOLLERR)
|
||||
mask |= EV_ERR;
|
||||
if (ep[i].events & EPOLLHUP) {
|
||||
mask |= EV_HUP;
|
||||
epoll_ctl(loop->efd, EPOLL_CTL_DEL, fd->fd, NULL);
|
||||
}
|
||||
|
||||
fd->cb(fd, mask, fd->data);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user