From 526b4278d148a1d902ca4144e2f6c6f8436aa06e Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Fri, 30 Oct 2015 23:42:35 +0100 Subject: [PATCH] Add more debug messages. --- test.c | 3 ++- utcp.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/test.c b/test.c index 15d5772..a078e1f 100644 --- a/test.c +++ b/test.c @@ -215,7 +215,8 @@ int main(int argc, char *argv[]) { inpktno++; if(inpktno >= dropto || inpktno < dropfrom || drand48() >= dropin) { total_in += len; - utcp_recv(u, buf, len); + if(utcp_recv(u, buf, len) == -1) + debug("Error receiving UTCP packet: %s\n", strerror(errno)); } else { debug("Dropped incoming packet\n"); } diff --git a/utcp.c b/utcp.c index 026fb31..9bae7b9 100644 --- a/utcp.c +++ b/utcp.c @@ -857,8 +857,10 @@ ssize_t utcp_recv(struct utcp *utcp, const void *data, size_t len) { // In case this is for a CLOSED connection, ignore the packet. // TODO: make it so incoming packets can never match a CLOSED connection. - if(c->state == CLOSED) + if(c->state == CLOSED) { + debug("Got packet for closed connection\n"); return 0; + } // It is for an existing connection. -- 2.39.5