]> 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>
Sat, 30 May 2020 19:59:30 +0000 (21:59 +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 c4305cd4de4978d265155f2dcb537cd746e39251..3b45c39d1db8e87373dd5815111dc35a8742d0eb 100644 (file)
@@ -660,6 +660,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);
 }
 
@@ -1728,6 +1729,7 @@ skip_ack:
                                c->snd.last++;
                                set_state(c, FIN_WAIT_1);
                        } else {
+                               c->do_poll = true;
                                set_state(c, ESTABLISHED);
                        }