Skip to content

Commit d6b9187

Browse files
authored
Fix for #3460 issue (#4424)
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]>
1 parent d6b383f commit d6b9187

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

Diff for: libraries/WiFiClientSecure/src/ssl_client.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -284,24 +284,21 @@ int data_to_read(sslclient_context *ssl_client)
284284
return res;
285285
}
286286

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

293-
while ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0) {
294-
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
295-
return handle_error(ret);
296-
}
292+
if ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0){
293+
log_v("Handling error %d", ret); //for low level debug
294+
return handle_error(ret);
295+
} else{
296+
log_v("Returning with %d bytes written", ret); //for low level debug
297297
}
298298

299-
len = ret;
300-
//log_v("%d bytes written", len); //for low level debug
301299
return ret;
302300
}
303301

304-
305302
int get_ssl_receive(sslclient_context *ssl_client, uint8_t *data, int length)
306303
{
307304
//log_d( "Reading HTTP response..."); //for low level debug

0 commit comments

Comments
 (0)