gazelle/0026-get-fin-notice-app.patch
jiangheng 06f81f5a16 fix gazelle test issue
(cherry picked from commit 0fb1ee99ffc056f82e79ae3fb3b97f5ad4473dee)
2022-03-16 23:06:01 +08:00

46 lines
1.6 KiB
Diff

From a066142dfb38235ea46307e4b1d3395dcc2694a7 Mon Sep 17 00:00:00 2001
From: wuchangsheng <wuchangsheng2@huawei.com>
Date: Tue, 15 Mar 2022 17:47:42 +0800
Subject: [PATCH 26/34] get fin notice app
---
src/lstack/api/lstack_epoll.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/lstack/api/lstack_epoll.c b/src/lstack/api/lstack_epoll.c
index cf072b0..1f0aea8 100644
--- a/src/lstack/api/lstack_epoll.c
+++ b/src/lstack/api/lstack_epoll.c
@@ -73,6 +73,11 @@ void add_epoll_event(struct netconn *conn, uint32_t event)
/* conn sock nerver null, because lwip call this func */
struct lwip_sock *sock = get_socket(conn->socket);
+ /* close_wait event should be (EPOLLRDHUP | EPOLLIN), but lwip is EPOLLERR */
+ if (event == EPOLLERR && conn->pcb.tcp && conn->pcb.tcp->state == CLOSE_WAIT) {
+ event = EPOLLRDHUP | EPOLLIN | EPOLLERR;
+ }
+
/* shadow_fd event notice listen_fd */
if (sock->shadowed_sock) {
sock = sock->shadowed_sock;
@@ -286,7 +291,6 @@ static int32_t get_lwip_events(struct weakup_poll *weakup, void *out, uint32_t m
struct epoll_event *events = (struct epoll_event *)out;
struct pollfd *fds = (struct pollfd *)out;
-
if (etype == TYPE_EPOLL) {
maxevents = LWIP_MIN(EPOLL_MAX_EVENTS, maxevents);
}
@@ -300,7 +304,7 @@ static int32_t get_lwip_events(struct weakup_poll *weakup, void *out, uint32_t m
}
/* close sock */
if (sock->stack == NULL) {
- return true;
+ continue;
}
__atomic_store_n(&sock->have_event, false, __ATOMIC_RELEASE);
--
1.8.3.1