First part of the WEBServer crash fix :) not finished yet
This commit is contained in:
parent
08576e441e
commit
ea0c82d8e4
@ -12,7 +12,7 @@ _rtc(),
|
||||
_rtcManager(_rtc),
|
||||
_connectivityManager(NULL),
|
||||
//_webServerManager(80, &_sdCardManager),
|
||||
_webServer(80, &_sdCardManager),
|
||||
_webServer(80, &_sdCardManager, 10),
|
||||
_ftpServer(21, &_sdCardManager, "ESP8266", "12345678"),
|
||||
_dbWSServer(81),
|
||||
_pcf(_boardConfig.getI2C_IOExpanderAddress(), Wire),
|
||||
@ -55,7 +55,7 @@ _rtc(),
|
||||
_rtcManager(_rtc),
|
||||
_connectivityManager(NULL),
|
||||
//_webServerManager(webServerPort, &_sdCardManager),
|
||||
_webServer(webServerPort, &_sdCardManager),
|
||||
_webServer(webServerPort, &_sdCardManager, 10),
|
||||
_ftpServer(ftpServerPort, &_sdCardManager, "ESP8266", "12345678"),
|
||||
_dbWSServer(81),
|
||||
_pcf(_boardConfig.getI2C_IOExpanderAddress(), Wire),
|
||||
|
@ -81,6 +81,8 @@ class TCPServer
|
||||
if(wc && wc.connected())
|
||||
{
|
||||
T *clientPointer = createNewClient(wc);
|
||||
//Activate keepAlive
|
||||
(clientPointer->_client).keepAlive(15, 5, 5);
|
||||
_clientList.addFirst(clientPointer);
|
||||
#ifdef DEBUG_TCPS
|
||||
Serial.printf("TCPServer : New client accepted. Id : %u , Number of clients : %u, local port : %u, remote port : %u\n",clientPointer->_id, _clientList.count(),clientPointer->_client.localPort(),clientPointer->_client.remotePort());
|
||||
@ -102,9 +104,7 @@ class TCPServer
|
||||
|
||||
virtual void greetClient(T *client)
|
||||
{
|
||||
client->_client.println(F("Successfully connected !"));
|
||||
client->_client.print(F("Your are client with id : "));
|
||||
client->_client.println(client->_id);
|
||||
client->_client.printf_P(PSTR("Successfully connected at %lu !\r\nYour are client with id : %u\r\n"), millis(), client->_id);
|
||||
}
|
||||
|
||||
virtual void getClientData()
|
||||
@ -137,6 +137,12 @@ class TCPServer
|
||||
#endif
|
||||
_currentClient->_clientState = TCPClient::DISCARDED;
|
||||
}
|
||||
else //Strange
|
||||
{
|
||||
#ifdef DEBUG_TCPS
|
||||
Serial.printf("Client status %u : %u and available : %u Is keepAlive enabled : %d\n", _currentClient->_id, (_currentClient->_client).status(), (_currentClient->_client).available(), (_currentClient->_client).isKeepAliveEnabled());
|
||||
#endif
|
||||
}
|
||||
|
||||
processClientData(_currentClient);//We process the actual data
|
||||
_currentClient->_newDataAvailable = false;
|
||||
@ -161,8 +167,8 @@ class TCPServer
|
||||
{
|
||||
if(client->_dataSize > 0 && ((char) client->_data[0] != '\r' && (char) client->_data[0] != '\n'))
|
||||
{
|
||||
Serial.print("Client --> ");Serial.print(client->_id);Serial.print(" : ");Serial.print((char *)client->_data);Serial.println("#");
|
||||
}
|
||||
Serial.printf("Client --> %u : #%s#\r\n", client->_id, (char *)client->_data);
|
||||
}
|
||||
|
||||
client->freeDataBuffer(client->_dataSize);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user