Fix connected to be wrongly reported in WiFiClient

This commit is contained in:
me-no-dev 2018-07-10 21:05:44 +02:00
parent c1a94b5326
commit 4e9d1ee237

View File

@ -438,23 +438,9 @@ uint8_t WiFiClient::connected()
if (_connected) {
uint8_t dummy;
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
if (res < 0) {
switch (errno) {
case ENOTCONN:
case EPIPE:
case ECONNRESET:
case ECONNREFUSED:
case ECONNABORTED:
if (res <= 0 && errno != EWOULDBLOCK) {
_connected = false;
break;
default:
_connected = true;
break;
}
} else if(res == 0){
_connected = false;
} else {
_connected = true;
log_i("Disconnected: RES: %d, ERR: %d", res, errno);
}
}
return _connected;