mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-04 14:26:31 +02:00
handshake in ssl_client.cpp (#2044)
* issue #2041 * handshake timeout * seconds to milliseconds
This commit is contained in:
committed by
Me No Dev
parent
0640964879
commit
46257c03b3
@ -158,12 +158,14 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
|
||||
mbedtls_ssl_set_bio(&ssl_client->ssl_ctx, &ssl_client->socket, mbedtls_net_send, mbedtls_net_recv, NULL );
|
||||
|
||||
log_v("Performing the SSL/TLS handshake...");
|
||||
|
||||
unsigned long handshake_start_time=millis();
|
||||
while ((ret = mbedtls_ssl_handshake(&ssl_client->ssl_ctx)) != 0) {
|
||||
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
|
||||
return handle_error(ret);
|
||||
}
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
if((millis()-handshake_start_time)>ssl_client->handshake_timeout)
|
||||
return -1;
|
||||
vTaskDelay(10 / portTICK_PERIOD_MS);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user