From: Guus Sliepen Date: Mon, 19 Oct 2015 20:03:21 +0000 (+0200) Subject: Fix bug in retransmit(). X-Git-Url: http://git.meshlink.io/?p=utcp;a=commitdiff_plain;h=64ef5642d83fc13829262ec6c1bddb6a20d9aa7a;ds=sidebyside 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. --- 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;