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
This commit is contained in:
Gregg 2024-06-08 18:03:37 -05:00
parent 892c2247a3
commit 7ab8354ed7
2 changed files with 8 additions and 13 deletions

View File

@ -250,8 +250,8 @@ void Span::pollTask() {
currentClient++; currentClient++;
} else { } else {
LOG1("** Client #%d DISCONNECTED (%lu sec)\n",currentClient->clientNumber,millis()/1000); LOG1("** Client #%d DISCONNECTED (%lu sec)\n",currentClient->clientNumber,millis()/1000);
currentClient->client.stop(); // currentClient->client.stop();
delay(5); // delay(5);
clearNotify(&*currentClient); // clear all notification requests for this connection clearNotify(&*currentClient); // clear all notification requests for this connection
currentClient=hapList.erase(currentClient); // remove HAPClient connection currentClient=hapList.erase(currentClient); // remove HAPClient connection
} }
@ -500,7 +500,7 @@ void Span::checkConnect(){
if(webLog.timeServer) if(webLog.timeServer)
xTaskCreateUniversal(webLog.initTime, "timeSeverTaskHandle", 8096, &webLog, 1, NULL, 0); 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(); hapServer->begin();
@ -2390,8 +2390,6 @@ void SpanWebLog::init(uint16_t maxEntries, const char *serv, const char *tz, con
isEnabled=true; isEnabled=true;
} }
log = (log_t *)HS_CALLOC(maxEntries,sizeof(log_t)); 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; enabled=true;
safeLoad=_safeLoad; safeLoad=_safeLoad;
auth=_auth; auth=_auth;
homeSpan.reserveSocketConnections(1);
if(pwd==NULL) if(pwd==NULL)
return(0); return(0);
return(setPassword(pwd)); return(setPassword(pwd));

View File

@ -238,8 +238,6 @@ class Span{
const char *defaultSetupCode=DEFAULT_SETUP_CODE; // Setup Code used for pairing const char *defaultSetupCode=DEFAULT_SETUP_CODE; // Setup Code used for pairing
uint16_t autoOffLED=0; // automatic turn-off duration (in seconds) for Status LED 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 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 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 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 char qrID[5]=""; // Setup ID used for pairing with QR Code
@ -341,7 +339,6 @@ class Span{
int getLogLevel(){return(logLevel);} // get Log Level 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) 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 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& 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& 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 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 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<Controller, Mallocator<Controller>>::const_iterator controllerListBegin(); list<Controller, Mallocator<Controller>>::const_iterator controllerListBegin();
list<Controller, Mallocator<Controller>>::const_iterator controllerListEnd(); list<Controller, Mallocator<Controller>>::const_iterator controllerListEnd();
[[deprecated("Please use reserveSocketConnections(n) method instead.")]] [[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.")]]
void setMaxConnections(uint8_t n){requestedMaxCon=n;} // sets maximum number of simultaneous HAP connections Span& reserveSocketConnections(uint8_t n){return(*this);}
}; };
/////////////////////////////// ///////////////////////////////