[riot-notifications] [RIOT-OS/RIOT] gnrc_tcp: rewrite passive open (#16459)

benpicco notifications at github.com
Thu Jul 1 20:07:01 CEST 2021


@benpicco commented on this pull request.

This looks good at a cursory glance 

> +                }
+            }
+#endif
+            tcb->local_port = local->port;
+            tcb->status |= STATUS_LISTENING;
+
+            /* Open connection */
+            ret = _gnrc_tcp_fsm(tcb, FSM_EVENT_CALL_OPEN, NULL, NULL, 0);
+        }
+
+        /* If anything goes wrong, discard all potentially opened connections. */
+        if (ret) {
+            for (size_t j = 0; j <= i; ++j) {
+                tcb->status &= ~(STATUS_LISTENING);
+                _abort(tcb);
+            }

should we `break` here?

> +        if (!(tmp->status & STATUS_ACCEPTED)) {
+

```suggestion
        if (tmp->status & STATUS_ACCEPTED) {
            continue;
        }
```

nesting

> @@ -196,8 +211,19 @@ static int _transition_to(gnrc_tcp_tcb_t *tcb, _gnrc_tcp_fsm_state_t state)
             break;
 
         case FSM_STATE_SYN_RCVD:
+            /* Setup timeout for listening TCBs */
+            if (tcb->status & STATUS_LISTENING) {
+                _gnrc_tcp_eventloop_sched(&tcb->event_timeout, CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS,

```suggestion
                _gnrc_tcp_eventloop_sched(&tcb->event_timeout,
                                          CONFIG_GNRC_TCP_CONNECTION_TIMEOUT_DURATION_MS,
```

-- 
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/16459#pullrequestreview-697329851
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210701/6efea597/attachment.htm>


More information about the notifications mailing list