Set delay b4 closing all TLS sessions after RESET
@@ -154,6 +154,16 @@ coap_audit_log(oc_message_t *msg)
}
#endif /* OC_SECURITY */
+#ifdef OC_SECURITY
+static oc_event_callback_retval_t
+close_all_tls_sessions(void *data)
+{
+ size_t device = (size_t)data;
+ oc_close_all_tls_sessions_for_device(device);
+ return OC_EVENT_DONE;
+}
+#endif /* OC_SECURITY */
+
/*---------------------------------------------------------------------------*/
/*- Internal API ------------------------------------------------------------*/
/*---------------------------------------------------------------------------*/
@@ -864,7 +874,8 @@ send_message:
#ifdef OC_SECURITY
if (coap_status_code == CLOSE_ALL_TLS_SESSIONS) {
- oc_close_all_tls_sessions_for_device(msg->endpoint.device);
+ oc_set_delayed_callback((void *)msg->endpoint.device,
+ &close_all_tls_sessions, 2);
}
#endif /* OC_SECURITY */
