mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-25 20:02:37 +03:00
Remove deadlock when server is not acking our data (#6107)
* Use bounded waiting instead of infinite one to avoid deadlock * Reduce timeout to fail much sooner if server is not acking our data * Return timeout to 15 seconds on every disconnect * Add comment to introduced delay to make it super clear
This commit is contained in:
parent
2b7846da5a
commit
912c0db091
@ -248,6 +248,7 @@ void WiFiClientSecure::_freeSSL() {
|
|||||||
_recvapp_len = 0;
|
_recvapp_len = 0;
|
||||||
// This connection is toast
|
// This connection is toast
|
||||||
_handshake_done = false;
|
_handshake_done = false;
|
||||||
|
_timeout = 15000;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WiFiClientSecure::_clientConnected() {
|
bool WiFiClientSecure::_clientConnected() {
|
||||||
@ -1009,6 +1010,9 @@ bool WiFiClientSecure::_connectSSL(const char* hostName) {
|
|||||||
_x509_insecure = nullptr;
|
_x509_insecure = nullptr;
|
||||||
_x509_knownkey = nullptr;
|
_x509_knownkey = nullptr;
|
||||||
|
|
||||||
|
// reduce timeout after successful handshake to fail fast if server stop accepting our data for whathever reason
|
||||||
|
if (ret) _timeout = 5000;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -456,7 +456,8 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
_send_waiting = true;
|
_send_waiting = true;
|
||||||
esp_yield();
|
// This delay will be interrupted by esp_schedule on next received ack
|
||||||
|
delay(_timeout_ms);
|
||||||
} while(true);
|
} while(true);
|
||||||
_send_waiting = false;
|
_send_waiting = false;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user