only process write events if file descriptor has not been tidied (may fix #355)

This commit is contained in:
Yves Rűtschlé 2022-11-03 17:23:49 +01:00
parent d166b8977c
commit 02573eb44b

View File

@ -168,7 +168,10 @@ void main_loop(struct listen_endpoint listen_sockets[], int num_addr_listen)
/* Check all sockets for write activity */
for (i = 0; i < fd_info.watchers->max_fd; i++) {
if (FD_ISSET(i, &writefds)) {
/* Check if it's active AND currently monitored (if a connection
* died, it gets tidied, which closes both sockets, but writefs does
* not know about that */
if (FD_ISSET(i, &writefds) && FD_ISSET(i, &fd_info.watchers->fds_w)) {
cnx_write_process(&fd_info, i);
}
}