Fix connected to be wrongly reported in WiFiClient
This commit is contained in:
parent
c1a94b5326
commit
4e9d1ee237
@ -438,23 +438,9 @@ uint8_t WiFiClient::connected()
|
|||||||
if (_connected) {
|
if (_connected) {
|
||||||
uint8_t dummy;
|
uint8_t dummy;
|
||||||
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
|
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
|
||||||
if (res < 0) {
|
if (res <= 0 && errno != EWOULDBLOCK) {
|
||||||
switch (errno) {
|
|
||||||
case ENOTCONN:
|
|
||||||
case EPIPE:
|
|
||||||
case ECONNRESET:
|
|
||||||
case ECONNREFUSED:
|
|
||||||
case ECONNABORTED:
|
|
||||||
_connected = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_connected = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if(res == 0){
|
|
||||||
_connected = false;
|
_connected = false;
|
||||||
} else {
|
log_i("Disconnected: RES: %d, ERR: %d", res, errno);
|
||||||
_connected = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _connected;
|
return _connected;
|
||||||
|
Loading…
Reference in New Issue
Block a user