Skip to content

Commit ecf51ac

Browse files
authored
Remove workaround of sockets always return -76
Remove workaround of sockets always return -76 (because it's fixed on IDF now) Remove delay during handshake (improving stability)
1 parent 5c73a6c commit ecf51ac

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

libraries/WiFiClientSecure/src/ssl_client.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <lwip/netdb.h>
1616
#include "ssl_client.h"
1717

18+
1819
const char *pers = "esp32-tls";
1920

2021
static int handle_error(int err)
@@ -153,11 +154,9 @@ int start_ssl_client(sslclient_context *ssl_client, uint32_t ipAddress, uint32_t
153154
log_i("Performing the SSL/TLS handshake...");
154155

155156
while ((ret = mbedtls_ssl_handshake(&ssl_client->ssl_ctx)) != 0) {
156-
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE && ret != -76) { //workaround for bug: https://github.com/espressif/esp-idf/issues/434
157+
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
157158
return handle_error(ret);
158159
}
159-
delay(10);
160-
vPortYield();
161160
}
162161

163162

@@ -224,7 +223,7 @@ int data_to_read(sslclient_context *ssl_client)
224223
//log_e("RET: %i",ret); //for low level debug
225224
res = mbedtls_ssl_get_bytes_avail(&ssl_client->ssl_ctx);
226225
//log_e("RES: %i",res);
227-
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE && ret < 0 && ret != -76) {
226+
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE && ret < 0) {
228227
return handle_error(ret);
229228
}
230229

@@ -238,7 +237,7 @@ int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, uint16_t l
238237
int ret = -1;
239238

240239
while ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0) {
241-
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE && ret != -76) {
240+
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
242241
return handle_error(ret);
243242
}
244243
}

0 commit comments

Comments
 (0)