[riot-notifications] [RIOT-OS/RIOT] sock/async: add function to retrieve session object of current DTLS event (#15755)

János Brodbeck notifications at github.com
Fri Jan 15 12:34:45 CET 2021


@janosbrodbeck commented on this pull request.



> @@ -87,6 +87,7 @@ static int _read(struct dtls_context_t *ctx, session_t *session, uint8_t *buf,
     sock->buffer.session = session;
 #ifdef SOCK_HAS_ASYNC
     if (sock->async_cb != NULL) {
+        memcpy(&sock->async_cb_session, session, sizeof(session_t));

Only those two events, yes. The number of sessions that a device can hold will probably never be huge. Sessions are expensive (even more so with wolfSSL). I also think it is very unlikely that this scenario will occur in practice. But i also don't want to exclude it to be honest. However, when it happens you can actually prevent resulting problems at the application level. It's not optimal...but I don't know any other solution at the moment. 

In case of doubt if problems occur we could make setting both event types configurable. Which means: If you only need one event type you could disable the setting of the other event type. This should lower the chance of the problem even more since then the session will be set for only one event type. For example I don't need the `SOCK_ASYNC_CONN_RDY` for gcoap currently. 



-- 
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/15755#discussion_r558249382
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210115/56baca5b/attachment.htm>


More information about the notifications mailing list