1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Fix issue with multiple clients on WebServer

This commit is contained in:
Mimmo La Fauci
2013-03-22 13:42:12 +01:00
parent dc3102d2f4
commit 792056d62b
9 changed files with 16356 additions and 16626 deletions

View File

@ -131,12 +131,11 @@ void WiFiClient::stop() {
ServerDrv::stopClient(_sock);
WiFiClass::_state[_sock] = NA_STATE;
unsigned long start = millis();
int count = 0;
// wait maximum 5 secs for the connection to close
while (status() != CLOSED && ++count < 50)
delay(100);
// wait a second for the connection to close
while (status() != CLOSED && millis() - start < 1000)
delay(1);
_sock = 255;
}
@ -150,7 +149,7 @@ uint8_t WiFiClient::connected() {
return !(s == LISTEN || s == CLOSED || s == FIN_WAIT_1 ||
s == FIN_WAIT_2 || s == TIME_WAIT ||
s == SYN_SENT || s== SYN_RCVD ||
(s == CLOSE_WAIT && !available()));
(s == CLOSE_WAIT));
}
}