mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-06 23:27:04 +02:00
[BUG] don't call epoll_ctl() on closed sockets
Some I/O callbacks are able to close their socket themselves. We want to check this before calling epoll_ctl(EPOLL_CTL_DEL), otherwise we get a -1 EBADF. Right now is looks like this could not cause any trouble but the case is racy enough to fix it.
This commit is contained in:
parent
3884cbaae6
commit
1eead503da
@ -388,6 +388,10 @@ REGPRM2 static void _do_poll(struct poller *p, int exp)
|
||||
fd_list[fd].e &= ~FD_EV_MASK_W;
|
||||
}
|
||||
|
||||
/* one callback might already have closed the fd by itself */
|
||||
if (fdtab[fd].state == FD_STCLOSE)
|
||||
continue;
|
||||
|
||||
/* Now, we will adjust the event in the poll list. Indeed, it
|
||||
* is possible that an event which was previously in the poll
|
||||
* list now goes out, and the opposite is possible too. We can
|
||||
|
Loading…
Reference in New Issue
Block a user