[riot-notifications] [RIOT-OS/RIOT] sock_dtls: add timeout to sock_dtls_send and sock_dtls_session_create (#14043)

Aiman Ismail notifications at github.com
Wed May 13 14:38:07 CEST 2020


@pokgak commented on this pull request.



>   *
  * @return  0 on success
- * @return  -EAGAIN, if DTLS_HANDSHAKE_TIMEOUT is `0` and no data is available.
+ * @return  -EAGAIN, if @p timeout is `0` and handshake started.

In gcoap, session create is usually called from the main thread by the user, no problem here. But sometimes, session create will be called from the listening thread (CON, peer restarts), initiating a new handshake, so the thread will be blocked until the handshake is finished or timeout. The problem here is we have a nested loop (session create loop in event loop) which will stop handling all other messages until the handshake is finished or timeout.

With `timeout=0` we can start the handshake and let the event loop handles receiving the handshake message. When the handshake message is complete, we can then resend the message that are due. I'm not sure how it is now with async merged but I assume it will be the same because we still have the event handler loop to handle receives.


-- 
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/14043#discussion_r424402664
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200513/7a6d0b19/attachment.htm>


More information about the notifications mailing list