mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-30 16:24:09 +03:00
Return sensible values from Client::connected() and Client::status() if we know it's not connected.
This commit is contained in:
@ -109,12 +109,15 @@ void Client::stop() {
|
||||
}
|
||||
|
||||
uint8_t Client::connected() {
|
||||
if (!_connected) return 0;
|
||||
|
||||
uint8_t s = status();
|
||||
return !(s == SnSR::LISTEN || s == SnSR::CLOSED || s == SnSR::FIN_WAIT ||
|
||||
(s == SnSR::CLOSE_WAIT && !available()));
|
||||
}
|
||||
|
||||
uint8_t Client::status() {
|
||||
if (!_connected) return SnSR::CLOSED;
|
||||
return W5100.readSnSR(_sock);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user