Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 44f5a4d

Browse filesBrowse files
committed
Fix Client returning disconnected because of VFS errors
1 parent e63aa40 commit 44f5a4d
Copy full SHA for 44f5a4d

File tree

1 file changed

+17
-3
lines changed
Filter options

1 file changed

+17
-3
lines changed

‎libraries/WiFi/src/WiFiClient.cpp

Copy file name to clipboardExpand all lines: libraries/WiFi/src/WiFiClient.cpp
+17-3Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,9 +438,23 @@ uint8_t WiFiClient::connected()
438438
if (_connected) {
439439
uint8_t dummy;
440440
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);
441+
switch (errno) {
442+
case EWOULDBLOCK:
443+
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+
break;
454+
default:
455+
log_i("Unexpected: RES: %d, ERR: %d", res, errno);
456+
_connected = true;
457+
break;
444458
}
445459
}
446460
return _connected;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.