<p></p>
<p><b>@benpicco</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/15549#discussion_r639676301">sys/net/application_layer/gcoap/gcoap.c</a>:</p>
<pre style='color:#555'>> +        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) {
</pre>
<p>Yes, if the only reason to get the oldest session is to destroy it, it might as well be done internally.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/15549#discussion_r639676301">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYBBT5CBY6KDUE2QSKTTPTSNVANCNFSM4UL2PR7Q">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYFNL5CWQPJUPOJX7MDTPTSNVA5CNFSM4UL2PR72YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOE7PWUYA.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/15549#discussion_r639676301",
"url": "https://github.com/RIOT-OS/RIOT/pull/15549#discussion_r639676301",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>