From: Guus Sliepen Date: Fri, 30 Oct 2015 22:16:24 +0000 (+0100) Subject: Log when dropping packets in the test program. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=d91fb4d8ac423f782ceb863b20e40095b891231b;p=utcp Log when dropping packets in the test program. --- diff --git a/test.c b/test.c index d138fd6..15d5772 100644 --- a/test.c +++ b/test.c @@ -69,8 +69,10 @@ ssize_t do_send(struct utcp *utcp, const void *data, size_t len) { int s = *(int *)utcp->priv; outpktno++; if(outpktno >= dropfrom && outpktno < dropto) { - if(drand48() < dropout) + if(drand48() < dropout) { + debug("Dropped outgoing packet\n"); return len; + } if(!reorder_data && drand48() < reorder) { reorder_data = malloc(len); if(!reorder_data) { @@ -214,6 +216,8 @@ int main(int argc, char *argv[]) { if(inpktno >= dropto || inpktno < dropfrom || drand48() >= dropin) { total_in += len; utcp_recv(u, buf, len); + } else { + debug("Dropped incoming packet\n"); } }