]> git.meshlink.io Git - utcp/commitdiff
Reset the snd.nxt pointer when starting packet retransmission.
authorGuus Sliepen <guus@meshlink.io>
Sun, 11 Oct 2015 21:39:23 +0000 (23:39 +0200)
committerGuus Sliepen <guus@sliepen.org>
Sun, 2 Jul 2017 10:01:32 +0000 (12:01 +0200)
When a packet was lost, and the send buffer contains more than two packets,
this only retransmitted the first packet from the send buffer, then when it
got acked it would continue with the tail of the buffer. Then it would have
to wait for another timeout to send the next packet from the start of the
send buffer. If the application is continuously sending data, then the send
buffer would never become empty and the problem would persist.

utcp.c

diff --git a/utcp.c b/utcp.c
index e347bb7165209b284409c6f92fca724993c05c04..7624aa576d39c8753c810cea4c4f8643c377d3d4 100644 (file)
--- a/utcp.c
+++ b/utcp.c
@@ -500,6 +500,7 @@ static void retransmit(struct utcp_connection *c) {
                                len--;
                                pkt->hdr.ctl |= FIN;
                        }
+                       c->snd.nxt = c->snd.una + len;
                        buffer_copy(&c->sndbuf, pkt->data, 0, len);
                        print_packet(c->utcp, "rtrx", pkt, sizeof pkt->hdr + len);
                        utcp->send(utcp, pkt, sizeof pkt->hdr + len);