From 5dbdb572406e168205cb9e54b2c247e97a57c22c Mon Sep 17 00:00:00 2001 From: compile_success <980965867@qq.com> Date: Sat, 29 Jun 2024 07:17:27 +0000 Subject: [PATCH] fix poll init not clear old fd --- src/lstack/api/lstack_epoll.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c index 2791dd7..2ac7150 100644 --- a/src/lstack/api/lstack_epoll.c +++ b/src/lstack/api/lstack_epoll.c @@ -837,14 +837,15 @@ static void poll_init(struct wakeup_poll *wakeup, struct pollfd *fds, nfds_t nfd continue; } } - wakeup->last_fds[i].fd = fd; - wakeup->last_fds[i].events = fds[i].events; - poll_change = 1; if (sock == NULL || sock->conn == NULL || CONN_TYPE_HAS_HOST(sock->conn)) { update_kernel_poll(wakeup, i, fds + i); } + wakeup->last_fds[i].fd = fd; + wakeup->last_fds[i].events = fds[i].events; + poll_change = 1; + while (sock && sock->conn) { sock->epoll_events = fds[i].events | POLLERR; sock->wakeup = wakeup; -- 2.33.0