Skip to content

Commit 4e9d1ee

Browse files
committedJul 10, 2018
Fix connected to be wrongly reported in WiFiClient
1 parent c1a94b5 commit 4e9d1ee

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed
 

‎libraries/WiFi/src/WiFiClient.cpp

+2-16
Original file line numberDiff line numberDiff line change
@@ -438,23 +438,9 @@ uint8_t WiFiClient::connected()
438438
if (_connected) {
439439
uint8_t dummy;
440440
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
441-
if (res < 0) {
442-
switch (errno) {
443-
case ENOTCONN:
444-
case EPIPE:
445-
case ECONNRESET:
446-
case ECONNREFUSED:
447-
case ECONNABORTED:
448-
_connected = false;
449-
break;
450-
default:
451-
_connected = true;
452-
break;
453-
}
454-
} else if(res == 0){
441+
if (res <= 0 && errno != EWOULDBLOCK) {
455442
_connected = false;
456-
} else {
457-
_connected = true;
443+
log_i("Disconnected: RES: %d, ERR: %d", res, errno);
458444
}
459445
}
460446
return _connected;

0 commit comments

Comments
 (0)
Please sign in to comment.