From 64ef5642d83fc13829262ec6c1bddb6a20d9aa7a Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 19 Oct 2015 22:03:21 +0200 Subject: [PATCH] Fix bug in retransmit(). The logic to check whether we actually have something to retransmit was wrong, causing retransmit() to bail out early without setting or resetting the timer. This also caused utcp_timeout() to return a negative value. --- utcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utcp.c b/utcp.c index 89a38b7..7c57701 100644 --- a/utcp.c +++ b/utcp.c @@ -547,8 +547,11 @@ static void swap_ports(struct hdr *hdr) { } static void retransmit(struct utcp_connection *c) { - if(c->state == CLOSED || c->snd.nxt == c->snd.una) + if(c->state == CLOSED || c->snd.last == c->snd.una) { + debug("Retransmit() called but nothing to retransmit!\n"); + stop_retransmit_timer(c); return; + } struct utcp *utcp = c->utcp; -- 2.39.2