Skip to content

Commit

Permalink
Configurable WiFiClientSecure connect timeout, better default value (e…
Browse files Browse the repository at this point in the history
…sp8266#4027)

* WiFiClientSecure: use _timeout setting when connecting

This timeout value can be customized via a call to setTimeout function.

Closes esp8266#3944.

* WiFiClientSecure: increase default connection timeout to 15 sec
  • Loading branch information
igrr authored and devyte committed Dec 26, 2017
1 parent ddda374 commit fac6490
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/ESP8266WiFi/src/WiFiClientSecure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ ClientContext* SSLContext::s_io_ctx = nullptr;

WiFiClientSecure::WiFiClientSecure()
{
// TLS handshake may take more than the 5 second default timeout
_timeout = 15000;
}

WiFiClientSecure::~WiFiClientSecure()
Expand Down Expand Up @@ -459,7 +461,7 @@ int WiFiClientSecure::_connectSSL(const char* hostName)
_ssl = new SSLContext;
_ssl->ref();
}
_ssl->connect(_client, hostName, 5000);
_ssl->connect(_client, hostName, _timeout);

auto status = ssl_handshake_status(*_ssl);
if (status != SSL_OK) {
Expand Down

0 comments on commit fac6490

Please sign in to comment.