[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
Thu Jan 14 02:04:48 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;
     if (sock->async_cb != NULL) {
+        memcpy(&sock->async_cb_session, session, sizeof(session_t));

Thanks for the explanation. That makes the process more understandable. Will have to look at this mechanism in detail the next days...that's something you should always have in mind when using async callbacks.

> Question is: what do you do, if there were multiple events fired before the handler comes to handling it. With your approach you will always only have the chance to get the session of the last event fired (which given that events are identified by a bitfield you can't determined which it was).

I also thought of this while reading. The approach here then no longer works. The other idea with another parameter in the callback does not work then either. Hmm...

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210113/a457ea49/attachment.htm>

More information about the notifications mailing list