Skip to content

Conversation

@igolubic
Copy link
Contributor

@igolubicigolubic commented Oct 18, 2020

Fixes: #3460

This code has been run in production for 1 month and it looks stable, no data dropped and it definitely fixes the issue described. I think that this can be merged to avoid using custom package referencing in PlatformIO that has been used in quite a few projects for now.

@igolubicigolubic changed the title Fix for https://github.com/espressif/arduino-esp32/issues/3460 issueFix for espressif#3460 issueOct 18, 2020
@Bmooij
Copy link
Contributor

It seems logic to remove the while statement to prevent infinite looping.
I will test this solution the coming days

@me-no-devme-no-dev merged commit d6b9187 into espressif:masterNov 2, 2020
@bhupiister
Copy link

@igolubic If found this as more suitable, as it may take multiple attempts before it gets successful.. i have locked trials to 100

int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, size_t len){log_v("Writing HTTP request with %d bytes...", len); // for low level debug int ret = -1; int retry = 0; while ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0){if ((ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE && ret < 0) || retry >= 100){log_v("Trial # %d", retry); // for low level debug // Show number of attempts taken log_v("Handling error %d", ret); // for low level debug return handle_error(ret)} retry++; // wait for space to become available vTaskDelay(2)} log_v("Trial # %d", retry); // for low level debug // Show number of attempts taken return ret} 

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WifiClientSecure hangs on write - socket error

4 participants

@igolubic@Bmooij@bhupiister@me-no-dev