]> git.meshlink.io Git - utcp/commitdiff
Add better debugging of UDP style connections. feature/congestion-window
authorGuus Sliepen <guus@sliepen.org>
Fri, 27 Mar 2020 21:12:20 +0000 (22:12 +0100)
committerGuus Sliepen <guus@sliepen.org>
Fri, 27 Mar 2020 21:13:34 +0000 (22:13 +0100)
Report packets that are out of order, either because of reordering or
packet loss.

utcp.c

diff --git a/utcp.c b/utcp.c
index 72bb41d021f003e49897d24b92bcfda0456846cb..50c7e364a33b2ee68a8b5d95b5bdb3d106287756 100644 (file)
--- a/utcp.c
+++ b/utcp.c
@@ -1252,6 +1252,19 @@ synack:
                        // Otherwise, continue processing.
                        len = 0;
                }
+       } else {
+#if UTCP_DEBUG
+               int32_t rcv_offset = seqdiff(hdr.seq, c->rcv.nxt);
+
+               if(rcv_offset) {
+                       debug(c, "packet out of order, offset %u bytes", rcv_offset);
+               }
+
+               if(rcv_offset >= 0) {
+                       c->rcv.nxt = hdr.seq + len;
+               }
+
+#endif
        }
 
        c->snd.wnd = hdr.wnd; // TODO: move below