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

Martine Lenders notifications at github.com
Thu May 14 18:33:27 CEST 2020


@miri64 requested changes on this pull request.



> -    res = dtls_connect(sock->dtls_ctx, &remote->dtls_session);
+    sock_udp_ep_t local;
+    if (sock_udp_get_local(sock->udp_sock, &local) < 0) {
+        return -EADDRNOTAVAIL;
+    }
+    if (ep->port == 0) {
+        return -EINVAL;
+    }
+    switch (ep->family) {
+        case AF_INET:
+ #if IS_ACTIVE(SOCK_HAS_IPV6)
+        case AF_INET6:
+ #endif
+            break;
+        default:
+            return -EINVAL;
+    }

Shouldn't these checks come *before* changing `remote` in the lines before?

> @@ -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) {

Can `sock->udp_sock` be `NULL` here?

-- 
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#pullrequestreview-411983063
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20200514/4c7f85dc/attachment.htm>


More information about the notifications mailing list