@@ -52,11 +52,11 @@ static int _handle_error(int err, const char * file, int line)
5252 */
5353static int client_net_recv ( void *ctx, unsigned char *buf, size_t len ) {
5454 Client *client = (Client*)ctx;
55- if (!client) {
55+ if (!client) {
5656 log_e (" Uninitialised!" );
5757 return -1 ;
5858 }
59-
59+
6060 // if (!client->connected()) {
6161 // log_e("Not connected!");
6262 // return -2;
@@ -68,14 +68,14 @@ static int client_net_recv( void *ctx, unsigned char *buf, size_t len ) {
6868 if (result > 0 ) {
6969 // esp_log_buffer_hexdump_internal("SSL.RD", buf, (uint16_t)result, ESP_LOG_VERBOSE);
7070 }
71-
71+
7272 return result;
7373}
7474
7575int client_net_recv_timeout ( void *ctx, unsigned char *buf,
7676 size_t len, uint32_t timeout ) {
7777 Client *client = (Client*)ctx;
78- if (!client) {
78+ if (!client) {
7979 log_e (" Uninitialised!" );
8080 return -1 ;
8181 }
@@ -90,9 +90,9 @@ int client_net_recv_timeout( void *ctx, unsigned char *buf,
9090 delay (1 );
9191 } else break ;
9292 } while (millis () < tms);
93-
93+
9494 int result = client->read (buf, len);
95-
95+
9696 // lwIP interface return -1 if there is no data to read
9797 // report without throwing errors or block
9898 if (result <= 0 ) return MBEDTLS_ERR_SSL_WANT_READ;
@@ -102,7 +102,7 @@ int client_net_recv_timeout( void *ctx, unsigned char *buf,
102102 if (result > 0 ) {
103103 // esp_log_buffer_hexdump_internal("SSL.RD", buf, (uint16_t)result, ESP_LOG_VERBOSE);
104104 }
105-
105+
106106 return result;
107107}
108108
@@ -121,20 +121,20 @@ int client_net_recv_timeout( void *ctx, unsigned char *buf,
121121 */
122122static int client_net_send ( void *ctx, const unsigned char *buf, size_t len ) {
123123 Client *client = (Client*)ctx;
124- if (!client) {
124+ if (!client) {
125125 log_e (" Uninitialised!" );
126126 return -1 ;
127127 }
128-
128+
129129 // if (!client->connected()) {
130130 // log_e("Not connected!");
131131 // return -2;
132132 // }
133-
133+
134134 // esp_log_buffer_hexdump_internal("SSL.WR", buf, (uint16_t)len, ESP_LOG_VERBOSE);
135-
135+
136136 int result = client->write (buf, len);
137-
137+
138138 log_d (" SSL client TX res=%d len=%d" , result, len);
139139 return result;
140140}
@@ -342,7 +342,7 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
342342 } else {
343343 log_v (" Certificate verified." );
344344 }
345-
345+
346346 if ((rootCABuff != NULL ) || ((rootCAPath != NULL ))) {
347347 log_d (" free buffer" );
348348 mbedtls_x509_crt_free (&ssl_client->ca_cert );
@@ -354,7 +354,7 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
354354
355355 if (cli_key != NULL ) {
356356 mbedtls_pk_free (&ssl_client->client_key );
357- }
357+ }
358358
359359 // return ssl_client->socket;
360360 return 1 ;
0 commit comments