mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-01 03:47:23 +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() {
|
uint8_t Client::connected() {
|
||||||
|
if (!_connected) return 0;
|
||||||
|
|
||||||
uint8_t s = status();
|
uint8_t s = status();
|
||||||
return !(s == SnSR::LISTEN || s == SnSR::CLOSED || s == SnSR::FIN_WAIT ||
|
return !(s == SnSR::LISTEN || s == SnSR::CLOSED || s == SnSR::FIN_WAIT ||
|
||||||
(s == SnSR::CLOSE_WAIT && !available()));
|
(s == SnSR::CLOSE_WAIT && !available()));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t Client::status() {
|
uint8_t Client::status() {
|
||||||
|
if (!_connected) return SnSR::CLOSED;
|
||||||
return W5100.readSnSR(_sock);
|
return W5100.readSnSR(_sock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user