Skip to content

Commit 2cc92da

Browse files
committed
add timeout to _run_until loop
fixes esp8266#6464
1 parent f7b6aa9 commit 2cc92da

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

libraries/ESP8266WiFi/src/WiFiClientSecureBearSSL.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,16 @@ int WiFiClientSecure::_run_until(unsigned target, bool blocking) {
437437
DEBUG_BSSL("_run_until: Not connected\n");
438438
return -1;
439439
}
440+
441+
unsigned long startMillis = millis();
440442
for (int no_work = 0; blocking || no_work < 2;) {
441443
optimistic_yield(100);
442444

445+
if (millis() - startMillis > 30000) {
446+
DEBUG_BSSL("_run_until: Timeout\n");
447+
return -1;
448+
}
449+
443450
int state;
444451
state = br_ssl_engine_current_state(_eng);
445452
if (state & BR_SSL_CLOSED) {

0 commit comments

Comments
 (0)