mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/esp_tls_error_logging' into 'master'
esp-tls: Expand error logging See merge request idf/esp-idf!2284
This commit is contained in:
commit
50304d719e
@ -83,6 +83,7 @@ static int esp_tcp_connect(const char *host, int hostlen, int port)
|
|||||||
|
|
||||||
int ret = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
int ret = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
ESP_LOGE(TAG, "Failed to create socket (family %d socktype %d protocol %d)", res->ai_family, res->ai_socktype, res->ai_protocol);
|
||||||
goto err_freeaddr;
|
goto err_freeaddr;
|
||||||
}
|
}
|
||||||
int fd = ret;
|
int fd = ret;
|
||||||
@ -98,12 +99,13 @@ static int esp_tcp_connect(const char *host, int hostlen, int port)
|
|||||||
p->sin6_family = AF_INET6;
|
p->sin6_family = AF_INET6;
|
||||||
addr_ptr = p;
|
addr_ptr = p;
|
||||||
} else {
|
} else {
|
||||||
/* Unsupported Protocol Family */
|
ESP_LOGE(TAG, "Unsupported protocol family %d", res->ai_family);
|
||||||
goto err_freesocket;
|
goto err_freesocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = connect(fd, addr_ptr, res->ai_addrlen);
|
ret = connect(fd, addr_ptr, res->ai_addrlen);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
ESP_LOGE(TAG, "Failed to connnect to host (errno %d)", errno);
|
||||||
goto err_freesocket;
|
goto err_freesocket;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,11 +236,13 @@ exit:
|
|||||||
*/
|
*/
|
||||||
void esp_tls_conn_delete(esp_tls_t *tls)
|
void esp_tls_conn_delete(esp_tls_t *tls)
|
||||||
{
|
{
|
||||||
mbedtls_cleanup(tls);
|
if (tls != NULL) {
|
||||||
if (tls->sockfd) {
|
mbedtls_cleanup(tls);
|
||||||
close(tls->sockfd);
|
if (tls->sockfd) {
|
||||||
|
close(tls->sockfd);
|
||||||
|
}
|
||||||
|
free(tls);
|
||||||
}
|
}
|
||||||
free(tls);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static ssize_t tcp_write(esp_tls_t *tls, const char *data, size_t datalen)
|
static ssize_t tcp_write(esp_tls_t *tls, const char *data, size_t datalen)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user