Skip to content

Commit fac6490

Browse files
igrrdevyte
authored andcommitted
Configurable WiFiClientSecure connect timeout, better default value (#4027)
* WiFiClientSecure: use _timeout setting when connecting This timeout value can be customized via a call to setTimeout function. Closes #3944. * WiFiClientSecure: increase default connection timeout to 15 sec
1 parent ddda374 commit fac6490

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libraries/ESP8266WiFi/src/WiFiClientSecure.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,8 @@ ClientContext* SSLContext::s_io_ctx = nullptr;
404404

405405
WiFiClientSecure::WiFiClientSecure()
406406
{
407+
// TLS handshake may take more than the 5 second default timeout
408+
_timeout = 15000;
407409
}
408410

409411
WiFiClientSecure::~WiFiClientSecure()
@@ -459,7 +461,7 @@ int WiFiClientSecure::_connectSSL(const char* hostName)
459461
_ssl = new SSLContext;
460462
_ssl->ref();
461463
}
462-
_ssl->connect(_client, hostName, 5000);
464+
_ssl->connect(_client, hostName, _timeout);
463465

464466
auto status = ssl_handshake_status(*_ssl);
465467
if (status != SSL_OK) {

0 commit comments

Comments
 (0)