From eb85ec4ae5f32102430e0622e3855aaba110c032 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 14 Oct 2019 22:32:35 +0200 Subject: [PATCH] Fix retransmission timeout calculation. The RTO calculation was missing a factor 4 multiplication of the RTT variance, which caused it to set the RTO to a much lower value than specified by RFC 6298. This would result in more retranmissions and a lower throughput. --- utcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utcp.c b/utcp.c index f35f965..802d95a 100644 --- a/utcp.c +++ b/utcp.c @@ -415,13 +415,13 @@ static void update_rtt(struct utcp_connection *c, uint32_t rtt) { if(!utcp->srtt) { utcp->srtt = rtt; utcp->rttvar = rtt / 2; - utcp->rto = rtt + max(2 * rtt, CLOCK_GRANULARITY); } else { utcp->rttvar = (utcp->rttvar * 3 + absdiff(utcp->srtt, rtt)) / 4; utcp->srtt = (utcp->srtt * 7 + rtt) / 8; - utcp->rto = utcp->srtt + max(utcp->rttvar, CLOCK_GRANULARITY); } + utcp->rto = utcp->srtt + max(4 * utcp->rttvar, CLOCK_GRANULARITY); + if(utcp->rto > MAX_RTO) { utcp->rto = MAX_RTO; } -- 2.39.5