From c2faecc3f7cc219993638d6427d33e28681b78b2 Mon Sep 17 00:00:00 2001 From: Anton Yarcev Date: Mon, 6 Jun 2022 19:08:06 +0700 Subject: [PATCH] Add reuse flag Let's say, for example: without of this flag it's can't start asyncwebserver on 80 port after wifimanager(also on 80) is shutdowned. But wifimanager still may be started, because in "WiFiServer.cpp" of ESP8266WiFi lib it's creates tcp_pcb with "SOF_REUSEADDR" flag. --- src/ESPAsyncTCP.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ESPAsyncTCP.cpp b/src/ESPAsyncTCP.cpp index 7a9fdc7..d77cee3 100644 --- a/src/ESPAsyncTCP.cpp +++ b/src/ESPAsyncTCP.cpp @@ -1116,6 +1116,9 @@ void AsyncServer::begin(){ if (!pcb){ return; } + + // Reuse freed socket. + pcb->so_options |= SOF_REUSEADDR; tcp_setprio(pcb, TCP_PRIO_MIN); ip_addr_t local_addr;