Fix for espressif#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 <ivan@mvt-solutions.com>
This commit is contained in:
		
							parent
							
								
									d6b383f84b
								
							
						
					
					
						commit
						d6b91872cb
					
				| @ -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
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user