1
0
mirror of https://github.com/DCC-EX/CommandStation-EX.git synced 2024-12-23 12:51:24 +01:00

do not make delete client conditional

This commit is contained in:
Harald Barth 2022-08-05 19:54:01 +02:00
parent 01f129e25f
commit 5f1a263158

View File

@ -193,15 +193,17 @@ void WifiESP::loop() {
// really no good way to check for LISTEN especially in AP mode? // really no good way to check for LISTEN especially in AP mode?
if (APmode || WiFi.status() == WL_CONNECTED) { if (APmode || WiFi.status() == WL_CONNECTED) {
if (server->hasClient()) { // loop over all clients and remove inactive
// loop over all clients and remove inactive for (clientId=0; clientId<clients.size(); clientId++){
for (clientId=0; clientId<clients.size(); clientId++){ // check if client is there and alive
// check if client is there and alive if(!clients[clientId].connected()) {
if(!clients[clientId].connected()) { DIAG(F("Remove client %d %s"), clientId, clients[clientId].remoteIP().toString().c_str());
clients[clientId].stop(); CommandDistributor::forget(clientId);
clients.erase(clients.begin()+clientId); clients[clientId].stop();
} clients.erase(clients.begin()+clientId);
} }
}
if (server->hasClient()) {
WiFiClient client; WiFiClient client;
while (client = server->available()) { while (client = server->available()) {
clients.push_back(client); clients.push_back(client);