]> git.meshlink.io Git - utcp/commitdiff
Log when dropping packets in the test program.
authorGuus Sliepen <guus@meshlink.io>
Fri, 30 Oct 2015 22:16:24 +0000 (23:16 +0100)
committerGuus Sliepen <guus@sliepen.org>
Sun, 2 Jul 2017 10:13:54 +0000 (12:13 +0200)
test.c

diff --git a/test.c b/test.c
index d138fd60bc168adf713ed4c068b18d0f92abf29a..15d57720ec19d709f6b86ac6d1eed4c6b7fea1f1 100644 (file)
--- 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");
                        }
                }