From 7ab8354ed7633f750287b99ce50a857e090385e0 Mon Sep 17 00:00:00 2001 From: Gregg Date: Sat, 8 Jun 2024 18:03:37 -0500 Subject: [PATCH] Deleted setMaxConnections() and DEPRECATED reserveSocketConnections setMaxConnections() was deprecated many version ago and is now deleted reserveSocketConnections() is no longer needed since new HomeKit architecture does not require more than a few connections - this function has been deprecated and if used will not do anything --- src/HomeSpan.cpp | 9 +++------ src/HomeSpan.h | 12 +++++------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/HomeSpan.cpp b/src/HomeSpan.cpp index eef3bc3..25ee973 100644 --- a/src/HomeSpan.cpp +++ b/src/HomeSpan.cpp @@ -250,8 +250,8 @@ void Span::pollTask() { currentClient++; } else { LOG1("** Client #%d DISCONNECTED (%lu sec)\n",currentClient->clientNumber,millis()/1000); - currentClient->client.stop(); - delay(5); +// currentClient->client.stop(); +// delay(5); clearNotify(&*currentClient); // clear all notification requests for this connection currentClient=hapList.erase(currentClient); // remove HAPClient connection } @@ -500,7 +500,7 @@ void Span::checkConnect(){ if(webLog.timeServer) xTaskCreateUniversal(webLog.initTime, "timeSeverTaskHandle", 8096, &webLog, 1, NULL, 0); - LOG0("Starting HAP Server on port %d supporting %d simultaneous HomeKit Controller Connections...\n\n",tcpPortNum,maxConnections); + LOG0("Starting HAP Server on port %d...\n\n",tcpPortNum); hapServer->begin(); @@ -2390,8 +2390,6 @@ void SpanWebLog::init(uint16_t maxEntries, const char *serv, const char *tz, con isEnabled=true; } log = (log_t *)HS_CALLOC(maxEntries,sizeof(log_t)); - if(timeServer) - homeSpan.reserveSocketConnections(1); } /////////////////////////////// @@ -2458,7 +2456,6 @@ int SpanOTA::init(boolean _auth, boolean _safeLoad, const char *pwd){ enabled=true; safeLoad=_safeLoad; auth=_auth; - homeSpan.reserveSocketConnections(1); if(pwd==NULL) return(0); return(setPassword(pwd)); diff --git a/src/HomeSpan.h b/src/HomeSpan.h index 5cbb83e..94ad261 100644 --- a/src/HomeSpan.h +++ b/src/HomeSpan.h @@ -238,8 +238,6 @@ class Span{ const char *defaultSetupCode=DEFAULT_SETUP_CODE; // Setup Code used for pairing uint16_t autoOffLED=0; // automatic turn-off duration (in seconds) for Status LED int logLevel=DEFAULT_LOG_LEVEL; // level for writing out log messages to serial monitor - uint8_t maxConnections=CONFIG_LWIP_MAX_SOCKETS-2; // maximum number of allowed simultaneous HAP connections - uint8_t requestedMaxCon=CONFIG_LWIP_MAX_SOCKETS-2; // requested maximum number of simultaneous HAP connections unsigned long comModeLife=DEFAULT_COMMAND_TIMEOUT*1000; // length of time (in milliseconds) to keep Command Mode alive before resuming normal operations uint16_t tcpPortNum=DEFAULT_TCP_PORT; // port for TCP communications between HomeKit and HomeSpan char qrID[5]=""; // Setup ID used for pairing with QR Code @@ -341,7 +339,6 @@ class Span{ int getLogLevel(){return(logLevel);} // get Log Level Span& setSerialInputDisable(boolean val){serialInputDisabled=val;return(*this);} // sets whether serial input is disabled (true) or enabled (false) boolean getSerialInputDisable(){return(serialInputDisabled);} // returns true if serial input is disabled, or false if serial input in enabled - Span& reserveSocketConnections(uint8_t n){maxConnections-=n;return(*this);} // reserves n socket connections *not* to be used for HAP Span& setHostNameSuffix(const char *suffix){hostNameSuffix=suffix;return(*this);} // sets the hostName suffix to be used instead of the 6-byte AccessoryID Span& setPortNum(uint16_t port){tcpPortNum=port;return(*this);} // sets the TCP port number to use for communications between HomeKit and HomeSpan Span& setQRID(const char *id); // sets the Setup ID for optional pairing with a QR Code @@ -399,10 +396,11 @@ class Span{ Span& setTimeServerTimeout(uint32_t tSec){webLog.waitTime=tSec*1000;return(*this);} // sets wait time (in seconds) for optional web log time server to connect list>::const_iterator controllerListBegin(); - list>::const_iterator controllerListEnd(); - - [[deprecated("Please use reserveSocketConnections(n) method instead.")]] - void setMaxConnections(uint8_t n){requestedMaxCon=n;} // sets maximum number of simultaneous HAP connections + list>::const_iterator controllerListEnd(); + + [[deprecated("This function has been deprecated (it is not needed) and no longer does anything. Please remove from sketch to ensure backwards compatilibilty with future versions.")]] + Span& reserveSocketConnections(uint8_t n){return(*this);} + }; ///////////////////////////////