]> git.meshlink.io Git - utcp/commitdiff
Send ACKs also when receiving out-of-order data.
authorGuus Sliepen <guus@meshlink.io>
Sun, 18 Oct 2015 18:53:55 +0000 (20:53 +0200)
committerGuus Sliepen <guus@sliepen.org>
Sun, 2 Jul 2017 10:04:11 +0000 (12:04 +0200)
This is necessary to trigger the triplicate ACK detection on the sender.

Makefile
utcp.c

index d10352e50d4a90bfd1e301322665ccc71eecc623..c2429e5f9c256dfb01b8d02151cf293e4c4df2c0 100644 (file)
--- 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 c21d6ab664b0146030c44d60e6feb730e924f0d8..25590a091560df177d7bbd4d75afed8ad01ba4e1 100644 (file)
--- 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: