From f77823af16f5eff88203a1c183d4bb5c67e3d3b0 Mon Sep 17 00:00:00 2001 From: compile_success <980965867@qq.com> Date: Sat, 12 Nov 2022 13:27:36 +0000 Subject: [PATCH 16/20] add unlock before after --- src/lstack/api/lstack_epoll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c index ebad98e..8d5439b 100644 --- a/src/lstack/api/lstack_epoll.c +++ b/src/lstack/api/lstack_epoll.c @@ -57,10 +57,12 @@ void add_sock_event(struct lwip_sock *sock, uint32_t event) pthread_spin_lock(&wakeup->event_list_lock); /* app thread have read/write, event is outdated */ - if (event == EPOLLIN && sock->conn->state == NETCONN_LISTEN && !NETCONN_IS_DATAIN(sock)) { + if (event == EPOLLIN && sock->conn->state != NETCONN_LISTEN && !NETCONN_IS_DATAIN(sock)) { + pthread_spin_unlock(&wakeup->event_list_lock); return; } if (event == EPOLLOUT && !NETCONN_IS_OUTIDLE(sock)) { + pthread_spin_unlock(&wakeup->event_list_lock); return; } -- 2.23.0