From 4519a30135aefe790dc786a055e1708d29655e44 Mon Sep 17 00:00:00 2001 From: Nicolas Schurando <1104104+nschurando@users.noreply.github.com> Date: Tue, 16 Nov 2021 15:49:55 +0100 Subject: [PATCH] Fixed sockindex left with non-default value when connection fails. --- src/EthernetClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EthernetClient.cpp b/src/EthernetClient.cpp index 9762b56..1930d75 100644 --- a/src/EthernetClient.cpp +++ b/src/EthernetClient.cpp @@ -60,7 +60,7 @@ int EthernetClient::connect(IPAddress ip, uint16_t port) uint8_t stat = Ethernet.socketStatus(sockindex); if (stat == SnSR::ESTABLISHED) return 1; if (stat == SnSR::CLOSE_WAIT) return 1; - if (stat == SnSR::CLOSED) return 0; + if (stat == SnSR::CLOSED) { sockindex = MAX_SOCK_NUM; return 0; } if (millis() - start > _timeout) break; delay(1); }