From 065b0fe7ac355ba741f7a2be96738c4792e13cfe Mon Sep 17 00:00:00 2001
From: compile_success <980965867@qq.com>
Date: Thu, 18 Jul 2024 11:59:52 +0000
Subject: [PATCH] fix EPOLLIN event dropd

---
 src/lstack/api/lstack_epoll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index 06c708b..ff80003 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -208,6 +208,7 @@ static void raise_pending_events(struct wakeup_poll *wakeup, struct lwip_sock *s
 {
     uint32_t event = 0;
 
+    pthread_spin_lock(&wakeup->event_list_lock);
     if (NETCONN_IS_DATAIN(sock) || NETCONN_IS_ACCEPTIN(sock)) {
         event |= EPOLLIN;
     }
@@ -216,7 +217,6 @@ static void raise_pending_events(struct wakeup_poll *wakeup, struct lwip_sock *s
         event |= EPOLLERR | EPOLLIN;
     }
 
-    pthread_spin_lock(&wakeup->event_list_lock);
     if (NETCONN_IS_OUTIDLE(sock)) {
         /* lwip_netconn_do_connected set LIBOS FLAGS when connected */
         if (!POSIX_IS_CLOSED(sock) && POSIX_IS_TYPE(sock, POSIX_LWIP)) {
-- 
2.33.0

