esp-tls: socket will be set to -1 and will not be closed

Closes https://github.com/espressif/esp-idf/issues/9847
pull/9946/head
Yuan Jian Min 2022-09-26 19:15:04 +08:00 zatwierdzone przez Mahavir Jain
rodzic d08898aabc
commit 9a97cfbffc
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -270,8 +270,11 @@ void esp_mbedtls_conn_delete(esp_tls_t *tls)
if (tls != NULL) {
esp_mbedtls_cleanup(tls);
if (tls->is_tls) {
mbedtls_net_free(&tls->server_fd);
tls->sockfd = tls->server_fd.fd;
if (tls->server_fd.fd != -1) {
mbedtls_net_free(&tls->server_fd);
/* Socket is already closed by `mbedtls_net_free` and hence also change assignment of its copy to an invalid value */
tls->sockfd = -1;
}
}
}
}