Fix tls handshaking issue (#20721)

* Fix tls handshaking issue

* fixed time comparison issue

* removed multiplication from loop
This commit is contained in:
Pabasara Perera 2024-02-15 15:10:04 +05:30 committed by GitHub
parent 97821ab925
commit c0ae3dcaca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -557,11 +557,17 @@ int WiFiClientSecure_light::_run_until(unsigned target, bool blocking) {
DEBUG_BSSL("_run_until: Not connected\n");
return -1;
}
uint32_t t = millis();
for (int no_work = 0; blocking || no_work < 2;) {
if (blocking) {
// Only for blocking operations can we afford to yield()
optimistic_yield(100);
}
if (((int32_t)(millis() - (t + this->_loopTimeout)) >= 0)){
DEBUG_BSSL("_run_until: Timeout\n");
return -1;
}
int state;
state = br_ssl_engine_current_state(_eng);

View File

@ -131,6 +131,7 @@ class WiFiClientSecure_light : public WiFiClient {
}
private:
uint32_t _loopTimeout=5000;
void _clear();
bool _ctx_present;
std::shared_ptr<br_ssl_client_context> _sc;