File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -88,3 +88,31 @@ This error may pop up after switching between
88
88
`stable <https://github.com/esp8266/Arduino#stable-version- >`__ esp8266
89
89
/ Arduino package installations, or after upgrading the package version
90
90
:doc: `Read more <a04-board-generic-is-unknown >`.
91
+
92
+
93
+ How to clear TCP PCBs in time-wait state ?
94
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95
+
96
+ This is needed with lwIP-v1.4, less needed with lwIP-v2 but timeout is still
97
+ too high.
98
+
99
+ Time-wait PCB state helps TCP not confusing two consecutive connections with the
100
+ same (s-ip,s-port,d-ip,d-port) when the first is already closed but still
101
+ having duplicate packets lost in internet arriving later during the second.
102
+ Artificially clearing them is a workaround to help saving precious heap.
103
+
104
+ The following lines are compatible with both lwIP versions:
105
+
106
+ .. code :: cpp
107
+
108
+ // no need for #include
109
+ struct tcp_pcb;
110
+ extern struct tcp_pcb* tcp_tw_pcbs;
111
+ extern "C" void tcp_abort (struct tcp_pcb* pcb);
112
+
113
+ void tcpCleanup (void) {
114
+ while (tcp_tw_pcbs)
115
+ tcp_abort(tcp_tw_pcbs);
116
+ }
117
+
118
+ Ref. `#1923 <https://github.com/esp8266/Arduino/issues/1923 >`__
You can’t perform that action at this time.
0 commit comments