We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e63aa40 commit 44f5a4dCopy full SHA for 44f5a4d
libraries/WiFi/src/WiFiClient.cpp
@@ -438,9 +438,23 @@ uint8_t WiFiClient::connected()
438
if (_connected){
439
uint8_t dummy;
440
int res = recv(fd(), &dummy, 0, MSG_DONTWAIT);
441
-if (res <= 0 && errno != EWOULDBLOCK){
442
- _connected = false;
443
-log_i("Disconnected: RES: %d, ERR: %d", res, errno);
+switch (errno){
+case EWOULDBLOCK:
+case ENOENT: //caused by vfs
444
+ _connected = true;
445
+break;
446
+case ENOTCONN:
447
+case EPIPE:
448
+case ECONNRESET:
449
+case ECONNREFUSED:
450
+case ECONNABORTED:
451
+ _connected = false;
452
+log_d("Disconnected: RES: %d, ERR: %d", res, errno);
453
454
+default:
455
+log_i("Unexpected: RES: %d, ERR: %d", res, errno);
456
457
458
}
459
460
return _connected;
0 commit comments