Last active
January 1, 2024 09:22
-
-
Save d-a-v/ed67f7a6f476a043d1c7f347c829087e to your computer and use it in GitHub Desktop.
portable way to clear tcp pcb in time-wait (esp8266/Arduino) - tcpCleanup() fix for lwip2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/esp8266/Arduino/issues/1923 | |
// https://github.com/esp8266/Arduino/issues/4213 | |
// compatible with lwip-v1 and -v2 | |
// no need for #include | |
struct tcp_pcb; | |
extern struct tcp_pcb* tcp_tw_pcbs; | |
extern "C" void tcp_abort (struct tcp_pcb* pcb); | |
void tcpCleanup () | |
{ | |
while (tcp_tw_pcbs != NULL) | |
{ | |
tcp_abort(tcp_tw_pcbs); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment