From ac88329d34a742be3fa830eb3d616cb6a5c5a690 Mon Sep 17 00:00:00 2001 From: Gregg Date: Thu, 10 Feb 2022 21:55:03 -0600 Subject: [PATCH] Deprecated setMaxConnections(); Added reserveSocketConnections() Use homeSpan.reserveSocketConnections(n) to reserve n sockets *not* to be used for HAP. Multiple calls can be used to cumulate a total number of reserved sockets. This makes is easy to add reserveSocketConnections(n) at multiple point in the code whenever a certain number of sockets need to be reserved for use with that portion of the code. For example enableOTA() calls reserveSocketConnections(1). If both setMaxConnections(), and one or more reserveSocketConnections(), methods are called HomeSpan will use the more restrictive net value. --- src/HomeSpan.cpp | 7 +++---- src/HomeSpan.h | 20 +++++++++++++------- src/Settings.h | 1 - 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index 0435c93..f36956e 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -60,10 +60,9 @@ void Span::begin(Category catID, const char *displayName, const char *hostNameBa controlButton.init(controlPin); statusLED.init(statusPin,0,autoOffLED); - int maxLimit=CONFIG_LWIP_MAX_SOCKETS-2-otaEnabled; - if(maxConnections>maxLimit) - maxConnections=maxLimit; - + if(requestedMaxCon