Skip to content

Commit

Permalink
Fix for #3460 issue (#4424)
Browse files Browse the repository at this point in the history
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.

Co-authored-by: Ivan Golubic <[email protected]>
  • Loading branch information
igolubic and igolubic authored Nov 2, 2020
1 parent d6b383f commit d6b9187
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions libraries/WiFiClientSecure/src/ssl_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,24 +284,21 @@ int data_to_read(sslclient_context *ssl_client)
return res;
}


int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, uint16_t len)
{
log_v("Writing HTTP request..."); //for low level debug
log_v("Writing HTTP request with %d bytes...", len); //for low level debug
int ret = -1;

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) {
return handle_error(ret);
}
if ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0){
log_v("Handling error %d", ret); //for low level debug
return handle_error(ret);
} else{
log_v("Returning with %d bytes written", ret); //for low level debug
}

len = ret;
//log_v("%d bytes written", len); //for low level debug
return ret;
}


int get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, int length)
{
//log_d( "Reading HTTP response..."); //for low level debug
Expand Down

0 comments on commit d6b9187

Please sign in to comment.