From f795503080bc1e7a812d58da62513219d2b5db74 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 18 Oct 2015 20:53:55 +0200 Subject: [PATCH] Send ACKs also when receiving out-of-order data. This is necessary to trigger the triplicate ACK detection on the sender. --- Makefile | 2 +- utcp.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d10352e..c2429e5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -CFLAGS ?= -O2 -Wall -g +CFLAGS ?= -Og -Wall -g CFLAGS += -std=c99 -DUTCP_DEBUG BIN = selftest test diff --git a/utcp.c b/utcp.c index c21d6ab..25590a0 100644 --- a/utcp.c +++ b/utcp.c @@ -1017,6 +1017,7 @@ ssize_t utcp_recv(struct utcp *utcp, const void *data, size_t len) { //Reset the congestion window so we wait for ACKs. c->snd.nxt = c->snd.una; c->snd.cwnd = utcp->mtu; + start_retransmit_timer(c); } } } @@ -1164,7 +1165,7 @@ ssize_t utcp_recv(struct utcp *utcp, const void *data, size_t len) { // - or we got an ack, so we should maybe send a bit more data // -> sendatleastone = false - ack(c, prevrcvnxt != c->rcv.nxt); + ack(c, len || prevrcvnxt != c->rcv.nxt); return 0; reset: -- 2.39.2