From 83f65f2eee2d5c7d58b27021770926d53f0f193e Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 18 Mar 2020 22:24:52 +0100 Subject: [PATCH] Reset the retransmission timer when receiving duplicate ACKs. While we are getting duplicate ACKs, and are likely in fast recovery, keep resetting the retransmission timer, so that if fast recovery takes longer than the RTO, we don't trigger a slow start. When we do get a real timeout during fast recovery, reset the duplicate ACK counter to signal we are no longer in fast recovery. We also should not do anything when receiving duplicate ACKs when all data has already been ACKed. --- utcp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utcp.c b/utcp.c index 67d4be3..ac598dd 100644 --- a/utcp.c +++ b/utcp.c @@ -848,6 +848,7 @@ static void retransmit(struct utcp_connection *c) { } c->rtt_start.tv_sec = 0; // invalidate RTT timer + c->dupack = 0; // cancel any ongoing fast recovery cleanup: free(pkt); @@ -1457,7 +1458,7 @@ synack: break; } } else { - if(!len && is_reliable(c)) { + if(!len && is_reliable(c) && c->snd.una != c->snd.last) { c->dupack++; debug(c, "duplicate ACK %d\n", c->dupack); @@ -1484,6 +1485,11 @@ synack: debug_cwnd(c); } + + // We got an ACK which indicates the other side did get one of our packets. + // Reset the retransmission timer to avoid going to slow start, + // but don't touch the connection timeout. + start_retransmit_timer(c); } } -- 2.39.2