Skip to content

Commit d0da988

Browse files
author
Nicolas Schurando
committed
Fixed sockindex left with non-default value when connection fails.
1 parent 78aeaf5 commit d0da988

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/EthernetClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ int EthernetClient::connect(IPAddress ip, uint16_t port)
6060
uint8_t stat = Ethernet.socketStatus(_sockindex);
6161
if (stat == SnSR::ESTABLISHED) return 1;
6262
if (stat == SnSR::CLOSE_WAIT) return 1;
63-
if (stat == SnSR::CLOSED) return 0;
63+
if (stat == SnSR::CLOSED) { _sockindex = MAX_SOCK_NUM; return 0; }
6464
if (millis() - start > _timeout) break;
6565
delay(1);
6666
}

0 commit comments

Comments
 (0)