1 Star 0 Fork 48

hantwofish/lwip

forked from src-openEuler/lwip 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0022-notify-app-that-sock-state-changes-to-CLOSE_WAIT.patch 1.64 KB
一键复制 编辑 原始数据 按行查看 历史
From 05159c41efdc2f07ddbe3520330faf2675baa3d6 Mon Sep 17 00:00:00 2001
From: jiangheng <jiangheng12@huawei.com>
Date: Tue, 15 Mar 2022 20:10:07 +0800
Subject: [PATCH] notify app that sock changes to CLOSE_WAAIT
---
src/core/tcp_in.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
index 1652b86..0d3a2f1 100644
--- a/src/core/tcp_in.c
+++ b/src/core/tcp_in.c
@@ -58,6 +58,9 @@
#if LWIP_ND6_TCP_REACHABILITY_HINTS
#include "lwip/nd6.h"
#endif /* LWIP_ND6_TCP_REACHABILITY_HINTS */
+#if USE_LIBOS
+#include "lwip/api.h"
+#endif
#include <string.h>
@@ -1032,6 +1035,9 @@ tcp_process(struct tcp_pcb *pcb)
if (recv_flags & TF_GOT_FIN) {
tcp_ack_now(pcb);
pcb->state = CLOSE_WAIT;
+#if USE_LIBOS
+ API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
+#endif
}
} else {
/* incorrect ACK number, send RST */
@@ -1050,6 +1056,9 @@ tcp_process(struct tcp_pcb *pcb)
if (recv_flags & TF_GOT_FIN) { /* passive close */
tcp_ack_now(pcb);
pcb->state = CLOSE_WAIT;
+#if USE_LIBOS
+ API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
+#endif
}
break;
case FIN_WAIT_1:
@@ -1676,6 +1685,9 @@ tcp_receive(struct tcp_pcb *pcb)
recv_flags |= TF_GOT_FIN;
if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */
pcb->state = CLOSE_WAIT;
+#if USE_LIBOS
+ API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
+#endif
}
}
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hantwofish/lwip.git
git@gitee.com:hantwofish/lwip.git
hantwofish
lwip
lwip
master

搜索帮助