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

benpicco notifications at github.com
Wed Jul 7 14:01:39 CEST 2021


@benpicco commented on this pull request.

I think there is still something wrong here:
When playing around with two native RIOT nodes querying a third native RIOT node with

    coap get fe80::7837:fcff:fe7d:1aaf 5684 /.well-known/core

after a while one of the nodes would no longer receive a response. (This is after the `dsm: removed session` message), the server shows

```
CoAP server is listening on port 5684
Connection secured with DTLS
Free DTLS session slots: 1/1
 CLI requests sent: 0
CoAP open requests: 0
Configured Proxy: None
```

The clients meanwhile display

```
CoAP server is listening on port 5684
Connection secured with DTLS
Free DTLS session slots: 13/1
 CLI requests sent: 17
CoAP open requests: 0
Configured Proxy: None
```

This number increases with each request that does not receive a response. 

> @@ -917,6 +1004,18 @@ int gcoap_get_resource_list(void *buf, size_t maxlen, uint8_t cf);
 ssize_t gcoap_encode_link(const coap_resource_t *resource, char *buf,
                           size_t maxlen, coap_link_encoder_ctx_t *context);
 
+

```suggestion
```

> +            return;
+        }
+        sock_udp_ep_t ep;
+        sock_dtls_session_get_udp_ep(&socket.ctx_dtls_session, &ep);
+        _process_coap_pdu(&socket, &ep,  _listen_buf, res);
+    }
+}
+
+/* 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_least_recently_used_session(&_sock_dtls, &session) != -1) {

```suggestion
        if (dsm_get_least_recently_used_session(&_sock_dtls, &session) != -1) {
```

-- 
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#pullrequestreview-700913738
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210707/d9936cf0/attachment-0001.htm>


More information about the notifications mailing list