Commit 44f5a4db authored by me-no-dev's avatar me-no-dev

Fix Client returning disconnected because of VFS errors

parent e63aa406
......@@ -438,9 +438,23 @@ uint8_t WiFiClient::connected()
if (_connected) {
uint8_t dummy;
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
if (res <= 0 && errno != EWOULDBLOCK) {
_connected = false;
log_i("Disconnected: RES: %d, ERR: %d", res, errno);
switch (errno) {
case EWOULDBLOCK:
case ENOENT: //caused by vfs
_connected = true;
break;
case ENOTCONN:
case EPIPE:
case ECONNRESET:
case ECONNREFUSED:
case ECONNABORTED:
_connected = false;
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment