Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 560c0f4

Browse filesBrowse files
authored
Fix dropped SSL connection when buffer gets full. (espressif#4820)
mbedTLS requires repeated calls to mbedtls_ssl_write() whenever it returns MBEDTLS_ERR_SSL_WANT_READ or MBEDTLS_ERR_SSL_WANT_WRITE. this happens when the client sends data faster then the server or the connection can handle.
1 parent 4b3f5c8 commit 560c0f4
Copy full SHA for 560c0f4

File tree

1 file changed

+7
-5
lines changed
Filter options

1 file changed

+7
-5
lines changed

‎libraries/WiFiClientSecure/src/ssl_client.cpp

Copy file name to clipboardExpand all lines: libraries/WiFiClientSecure/src/ssl_client.cpp
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,13 @@ int send_ssl_data(sslclient_context *ssl_client, const uint8_t *data, uint16_t l
295295
log_v("Writing HTTP request with %d bytes...", len); //for low level debug
296296
int ret = -1;
297297

298-
if ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0){
299-
log_v("Handling error %d", ret); //for low level debug
300-
return handle_error(ret);
301-
} else{
302-
log_v("Returning with %d bytes written", ret); //for low level debug
298+
while ((ret = mbedtls_ssl_write(&ssl_client->ssl_ctx, data, len)) <= 0) {
299+
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE && ret < 0) {
300+
log_v("Handling error %d", ret); //for low level debug
301+
return handle_error(ret);
302+
}
303+
//wait for space to become available
304+
vTaskDelay(2);
303305
}
304306

305307
return ret;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.