]> git.meshlink.io Git - meshlink/commitdiff
Ensure the flush timer is started if we never had any full packets to send.
authorGuus Sliepen <guus@meshlink.io>
Wed, 27 May 2020 19:07:32 +0000 (21:07 +0200)
committerGuus Sliepen <guus@meshlink.io>
Wed, 27 May 2020 19:19:07 +0000 (21:19 +0200)
The flush timer ensures that if there is partial data left in the send
buffer for framed UDP channels, that this is sent after the flush timeout.
This was done correctly if we had previously sent full packets, but if there
never was a full packet the timer wouldn't be started, and the small frames
wouldn't be sent unless the application would send more data on the channel.

src/utcp.c

index 8ef59a063fdf8f3af5a1fbb021deced7775c7e73..d068d45b20ccd01d4f9e1b43f01e7becac95cdc3 100644 (file)
@@ -880,6 +880,9 @@ static void ack_unreliable_framed(struct utcp_connection *c) {
                        // There is no partial data in the send buffer, so stop the flush timer
                        stop_retransmit_timer(c);
                }
+       } else if(left && !timespec_isset(&c->rtrx_timeout)) {
+               // We have partial data and we didn't start the flush timer yet
+               start_flush_timer(c);
        }
 }