From: Guus Sliepen Date: Fri, 30 Oct 2015 22:42:35 +0000 (+0100) Subject: Add more debug messages. X-Git-Url: http://git.meshlink.io/?p=utcp;a=commitdiff_plain;h=526b4278d148a1d902ca4144e2f6c6f8436aa06e Add more debug messages. --- 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.