]> git.meshlink.io Git - meshlink/commitdiff
Ensure the poll callback is called when a channel is fully established.
authorGuus Sliepen <guus@meshlink.io>
Wed, 27 May 2020 19:00:32 +0000 (21:00 +0200)
committerGuus Sliepen <guus@meshlink.io>
Wed, 27 May 2020 19:19:07 +0000 (21:19 +0200)
The optimization that reduced how often the poll callback is called when
the application did not write anything to the channel in the callback also
inadvertently stopped it from being called right when the channel is
fully established.

src/utcp.c

index 2a1ac5b86f370ec319b833445a24c918f3bc4402..cbc094a1cbe060658969cc145fdf17c62d4ecdf9 100644 (file)
@@ -677,6 +677,7 @@ void utcp_accept(struct utcp_connection *c, utcp_recv_t recv, void *priv) {
        debug(c, "accepted %p %p\n", c, recv, priv);
        c->recv = recv;
        c->priv = priv;
+       c->do_poll = true;
        set_state(c, ESTABLISHED);
 }
 
@@ -2025,6 +2026,7 @@ skip_ack:
                                c->snd.last++;
                                set_state(c, FIN_WAIT_1);
                        } else {
+                               c->do_poll = true;
                                set_state(c, ESTABLISHED);
                        }