From: Guus Sliepen Date: Fri, 27 Mar 2020 21:12:20 +0000 (+0100) Subject: Add better debugging of UDP style connections. X-Git-Url: http://git.meshlink.io/?p=utcp;a=commitdiff_plain;h=36994569d1ba6839207761591964189d189c92d1 Add better debugging of UDP style connections. Report packets that are out of order, either because of reordering or packet loss. --- diff --git a/utcp.c b/utcp.c index 72bb41d..50c7e36 100644 --- 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