Fix Client returning disconnected because of VFS errors
This commit is contained in:
parent
e63aa40650
commit
44f5a4dbc8
@ -438,9 +438,23 @@ 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 && errno != EWOULDBLOCK) {
|
switch (errno) {
|
||||||
|
case EWOULDBLOCK:
|
||||||
|
case ENOENT: //caused by vfs
|
||||||
|
_connected = true;
|
||||||
|
break;
|
||||||
|
case ENOTCONN:
|
||||||
|
case EPIPE:
|
||||||
|
case ECONNRESET:
|
||||||
|
case ECONNREFUSED:
|
||||||
|
case ECONNABORTED:
|
||||||
_connected = false;
|
_connected = false;
|
||||||
log_i("Disconnected: RES: %d, ERR: %d", res, errno);
|
log_d("Disconnected: RES: %d, ERR: %d", res, errno);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log_i("Unexpected: RES: %d, ERR: %d", res, errno);
|
||||||
|
_connected = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _connected;
|
return _connected;
|
||||||
|
Loading…
Reference in New Issue
Block a user