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

János Brodbeck notifications at github.com
Wed May 26 15:34:26 CEST 2021


@janosbrodbeck commented on this pull request.



> +        sock_udp_ep_t ep;
+        sock_dtls_session_get_udp_ep(&socket.ctx_dtls_session, &ep);
+        _process_coap_pdu(&socket, &ep,  _listen_buf, res);
+    }
+}
+#endif
+
+#if IS_ACTIVE(CONFIG_GCOAP_ENABLE_DTLS)
+/* Timeout function to free up a session when too many session slots are occupied */
+static void _dtls_free_up_session(void *arg) {
+    (void)arg;
+    sock_dtls_session_t session;
+
+    uint8_t minimum_free = CONFIG_GCOAP_DTLS_MINIMUM_AVAILABLE_SESSIONS;
+    if (dsm_get_num_available_slots() < minimum_free) {
+        if(dsm_get_oldest_used_session(&_sock_dtls, &session) != -1) {

My concern is that it moves a decision from the user to dsm. `sock_dtls_session_destroy()` is one part of the DTLS API which needs a refactor. When ignoring my currently applied tinyDTLS hotfix: `sock_dtls_session_destroy()` can fail. It merely initiates session destroy. But how do handle closing failure? Re-try? Force destroy? I'd argue that should decide the user per application. More details on this topic is in my PR for this: https://github.com/RIOT-OS/RIOT/pull/16422

That's why I avoided implementing any real session handling that concerns the DTLS stack in dsm. 


-- 
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_r639730597
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210526/680ac50a/attachment.htm>


More information about the notifications mailing list