Skip to content

Commit 3d6e4e1

Browse files
committed
Use milliseconds for timeout
1 parent 01d7ea7 commit 3d6e4e1

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

libraries/WiFiClientSecure/src/WiFiClientSecure.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *_CA_cert,
124124
int WiFiClientSecure::connect(const char *host, uint16_t port, const char *_CA_cert, const char *_cert, const char *_private_key)
125125
{
126126
if(_timeout > 0){
127-
sslclient->handshake_timeout = _timeout * 1000;
127+
sslclient->handshake_timeout = _timeout;
128128
}
129129
int ret = start_ssl_client(sslclient, host, port, _timeout, _CA_cert, _cert, _private_key, NULL, NULL);
130130
_lastError = ret;
@@ -144,7 +144,7 @@ int WiFiClientSecure::connect(IPAddress ip, uint16_t port, const char *pskIdent,
144144
int WiFiClientSecure::connect(const char *host, uint16_t port, const char *pskIdent, const char *psKey) {
145145
log_v("start_ssl_client with PSK");
146146
if(_timeout > 0){
147-
sslclient->handshake_timeout = _timeout * 1000;
147+
sslclient->handshake_timeout = _timeout;
148148
}
149149
int ret = start_ssl_client(sslclient, host, port, _timeout, NULL, NULL, NULL, _pskIdent, _psKey);
150150
_lastError = ret;

libraries/WiFiClientSecure/src/ssl_client.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,8 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
7474

7575
if (lwip_connect(ssl_client->socket, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) == 0) {
7676
if(timeout <= 0){
77-
timeout = 30;
77+
timeout = 30000;
7878
}
79-
timeout *= 1000;//to milliseconds
8079
lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
8180
lwip_setsockopt(ssl_client->socket, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout));
8281
lwip_setsockopt(ssl_client->socket, IPPROTO_TCP, TCP_NODELAY, &enable, sizeof(enable));

0 commit comments

Comments
 (0)