mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Fixing bugs in Client::connect() (failed to set _sock to 255 after some connection failures).
This commit is contained in:
parent
b572172438
commit
ea6a645dc8
@ -42,13 +42,17 @@ uint8_t Client::connect() {
|
|||||||
if (_srcport + 1024 == 0) _srcport = 0;
|
if (_srcport + 1024 == 0) _srcport = 0;
|
||||||
socket(_sock, Sn_MR_TCP, _srcport + 1024, 0);
|
socket(_sock, Sn_MR_TCP, _srcport + 1024, 0);
|
||||||
|
|
||||||
if (!::connect(_sock, _ip, _port))
|
if (!::connect(_sock, _ip, _port)) {
|
||||||
|
_sock = 255;
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
while (status() != SOCK_ESTABLISHED) {
|
while (status() != SOCK_ESTABLISHED) {
|
||||||
delay(1);
|
delay(1);
|
||||||
if (status() == SOCK_CLOSED)
|
if (status() == SOCK_CLOSED) {
|
||||||
|
_sock = 255;
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user