]> git.meshlink.io Git - utcp/blobdiff - utcp.c
Add better debugging of UDP style connections.
[utcp] / 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