From 611db61d84906a012d8c86efeb0893498fb8ba9d Mon Sep 17 00:00:00 2001 From: chemicstry Date: Mon, 14 May 2018 14:01:22 +0300 Subject: [PATCH] Fix WiFiClient error handling (#1388) --- libraries/WiFi/src/WiFiClient.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libraries/WiFi/src/WiFiClient.cpp b/libraries/WiFi/src/WiFiClient.cpp index 5b8c0fb6..b908f71f 100644 --- a/libraries/WiFi/src/WiFiClient.cpp +++ b/libraries/WiFi/src/WiFiClient.cpp @@ -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; } }