[riot-notifications] [RIOT-OS/RIOT] net/gcoap: support DTLS (#15549)

benpicco notifications at github.com
Wed May 26 14:30:41 CEST 2021


@benpicco commented on this pull request.



> +        /* If not enough session slots left: set timeout to free up session */
+        uint8_t minimum_free = CONFIG_GCOAP_DTLS_MINIMUM_AVAILABLE_SESSIONS;
+        if (dsm_get_num_available_slots() < minimum_free)
+        {
+            uint32_t timeout = CONFIG_GCOAP_DTLS_MINIMUM_AVAILABLE_SESSIONS_TIMEOUT_USEC;
+            event_callback_init(&_dtls_session_free_up_tmout_cb,
+                                _dtls_free_up_session, NULL);
+            event_timeout_init(&_dtls_session_free_up_tmout, &_queue,
+                               &_dtls_session_free_up_tmout_cb.super);
+            event_timeout_set(&_dtls_session_free_up_tmout, timeout);
+        }
+    }
+
+    if (type & SOCK_ASYNC_CONN_FIN) {
+        if (sock_dtls_get_event_session(sock, &socket.ctx_dtls_session)) {
+            dsm_remove(sock, &socket.ctx_dtls_session);

Maybe add a comment that the session is already destroyed - everywhere else `dsm_remove()` and `sock_dtls_session_destroy()` always appear together (so I was wondering if it is justified to move `sock_dtls_session_destroy()` into `dsm_remove()`) 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15549#discussion_r639678138
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210526/1ff3c4c1/attachment.htm>


More information about the notifications mailing list