[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
Fri May 15 12:14:34 CEST 2020


@pokgak commented on this pull request.



> @@ -283,40 +271,36 @@ int sock_dtls_session_create(sock_dtls_t *sock, const sock_udp_ep_t *ep,
     memcpy(&remote->dtls_session.addr, &ep->addr.ipv6, sizeof(ipv6_addr_t));
     _ep_to_session(ep, &remote->dtls_session);
 
-    /* start a handshake */
-    DEBUG("sock_dtls: starting handshake\n");
-    res = dtls_connect(sock->dtls_ctx, &remote->dtls_session);
+    sock_udp_ep_t local;
+    if (sock_udp_get_local(sock->udp_sock, &local) < 0) {

`sock_dtls_create` which should be called first before calling `sock_dtls_session_init` already asserts that `udp_sock != NULL`. For APIs generally, do we also need to check if the user is calling the function in the wrong order?

For tinydtls, we don't require that the `udp_sock` is bound to a local `sock_udp_ep_t`. We specify the endpoint when calling `sock_udp_send` (see `_write`). 

> Alternatively, we can remove the `-EADDRNOTAVAIL` case and also assert, that `sock` is bound (i.e. for `tinydtls` `assert(sock->udp_sock)` when my previous statement was right).

So I think we should do this.

-- 
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_r425703992
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200515/5a1b1ee8/attachment.htm>


More information about the notifications mailing list