From 38cd7baf58f4e5384480e96445f20047116280e6 Mon Sep 17 00:00:00 2001 From: Andrey Klimov Date: Sun, 4 Oct 2020 02:43:44 +0300 Subject: [PATCH] OTA sockets leak fixed with every Ethernet interface restart (critical) --- lighthub/main.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lighthub/main.cpp b/lighthub/main.cpp index b49f18b..d96e34d 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -81,6 +81,7 @@ EthernetClient ethClient; #if defined(OTA) #include +bool OTA_initialized=false; #endif #if defined(__SAM3X8E__) @@ -716,8 +717,11 @@ void ip_ready_config_loaded_connecting_to_broker() { void setupOTA(void) { #ifdef OTA +if (OTA_initialized) return; +// ArduinoOTA.end(); // start the OTEthernet library with internal (flash) based storage ArduinoOTA.begin(Ethernet.localIP(), "Lighthub", "password", InternalStorage); +OTA_initialized=true; #endif } @@ -1668,6 +1672,11 @@ infoSerial<