oc_tls:do not send duplicate close_notify for TLS
@@ -366,7 +366,9 @@ oc_tls_inactive(void *data)
return OC_EVENT_CONTINUE;
}
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);
+ if ((peer->endpoint.flags & TCP) == 0) {
mbedtls_ssl_close_notify(&peer->ssl_ctx);
+ }
oc_tls_free_peer(peer, false);
}
}
