Fix WiFiClient error handling (#1388)

This commit is contained in:
chemicstry 2018-05-14 14:01:22 +03:00 committed by Me No Dev
parent 00f962439a
commit 611db61d84

View File

@ -313,7 +313,7 @@ uint8_t WiFiClient::connected()
if (_connected) {
uint8_t dummy;
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
if (res <= 0) {
if (res < 0) {
switch (errno) {
case ENOTCONN:
case EPIPE:
@ -328,7 +328,6 @@ uint8_t WiFiClient::connected()
}
}
else {
// Should never happen since requested 0 bytes
_connected = true;
}
}