From c6cca5f100c09769a5d260e729f4c149be964ea4 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng14@huawei.com>
Date: Sat, 28 Oct 2023 20:17:26 +0800
Subject: [PATCH] epoll: fix epollet mode error

---
 src/lstack/api/lstack_epoll.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index d1fb209..a711ae3 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -468,22 +468,22 @@ int32_t epoll_lwip_event_nolock(struct wakeup_poll *wakeup, struct epoll_event *
             continue;
         }
 
+        events[event_num].events = sock->events & sock->epoll_events;
+        events[event_num].data = sock->ep_data;
+        event_num++;
+
         if (sock->epoll_events & EPOLLET) {
             list_del_node_null(node);
             sock->events = 0;
         }
 
         /* EPOLLONESHOT: generate event after epoll_ctl add/mod event again
-           epoll_event set 0 avoid generating event util epoll_ctl set epoll_event a valu */
+           epoll_event set 0 avoid generating event util epoll_ctl reset epoll_event */
         if (sock->epoll_events & EPOLLONESHOT) {
             list_del_node_null(node);
             sock->epoll_events = 0;
         }
 
-        events[event_num].events = sock->events & sock->epoll_events;
-        events[event_num].data = sock->ep_data;
-        event_num++;
-
         if (event_num >= maxevents) {
             /* move list head after the current node, and start traversing from this node next time */
             list_del_node_null(&wakeup->event_list);
-- 
2.27.0

