diff --git a/security/oc_tls.c b/security/oc_tls.c index c5909310a759341081d937fc10a150f5febe99dc..96fd4aabe06abd29dfb877933497f41fe6d85c00 100644 --- a/security/oc_tls.c +++ b/security/oc_tls.c @@ -366,7 +366,9 @@ oc_tls_inactive(void *data) return OC_EVENT_CONTINUE; } mbedtls_ssl_close_notify(&peer->ssl_ctx); - mbedtls_ssl_close_notify(&peer->ssl_ctx); + if ((peer->endpoint.flags & TCP) == 0) { + mbedtls_ssl_close_notify(&peer->ssl_ctx); + } oc_tls_free_peer(peer, true); } OC_DBG("oc_tls: Terminating DTLS inactivity callback"); @@ -1333,7 +1335,9 @@ oc_tls_close_connection(oc_endpoint_t *endpoint) oc_tls_peer_t *peer = oc_tls_get_peer(endpoint); if (peer) { mbedtls_ssl_close_notify(&peer->ssl_ctx); - mbedtls_ssl_close_notify(&peer->ssl_ctx); + if ((peer->endpoint.flags & TCP) == 0) { + mbedtls_ssl_close_notify(&peer->ssl_ctx); + } oc_tls_free_peer(peer, false); } }