• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1From 05159c41efdc2f07ddbe3520330faf2675baa3d6 Mon Sep 17 00:00:00 2001
2From: jiangheng <jiangheng12@huawei.com>
3Date: Tue, 15 Mar 2022 20:10:07 +0800
4Subject: [PATCH] notify app that sock changes to CLOSE_WAAIT
5
6---
7 src/core/tcp_in.c | 12 ++++++++++++
8 1 file changed, 12 insertions(+)
9
10diff --git a/src/core/tcp_in.c b/src/core/tcp_in.c
11index 1652b86..0d3a2f1 100644
12--- a/src/core/tcp_in.c
13+++ b/src/core/tcp_in.c
14@@ -58,6 +58,9 @@
15 #if LWIP_ND6_TCP_REACHABILITY_HINTS
16 #include "lwip/nd6.h"
17 #endif /* LWIP_ND6_TCP_REACHABILITY_HINTS */
18+#if USE_LIBOS
19+#include "lwip/api.h"
20+#endif
21
22 #include <string.h>
23
24@@ -1032,6 +1035,9 @@ tcp_process(struct tcp_pcb *pcb)
25           if (recv_flags & TF_GOT_FIN) {
26             tcp_ack_now(pcb);
27             pcb->state = CLOSE_WAIT;
28+#if USE_LIBOS
29+            API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
30+#endif
31           }
32         } else {
33           /* incorrect ACK number, send RST */
34@@ -1050,6 +1056,9 @@ tcp_process(struct tcp_pcb *pcb)
35       if (recv_flags & TF_GOT_FIN) { /* passive close */
36         tcp_ack_now(pcb);
37         pcb->state = CLOSE_WAIT;
38+#if USE_LIBOS
39+        API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
40+#endif
41       }
42       break;
43     case FIN_WAIT_1:
44@@ -1676,6 +1685,9 @@ tcp_receive(struct tcp_pcb *pcb)
45             recv_flags |= TF_GOT_FIN;
46             if (pcb->state == ESTABLISHED) { /* force passive close or we can move to active close */
47               pcb->state = CLOSE_WAIT;
48+#if USE_LIBOS
49+              API_EVENT(((struct netconn *)pcb->callback_arg), NETCONN_EVT_ERROR, 0);
50+#endif
51             }
52           }
53
54--
551.8.3.1
56
57