X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=utcp.c;h=9bae7b9f87b10b81fee0e700e48c40b462043dae;hb=526b4278d148a1d902ca4144e2f6c6f8436aa06e;hp=f2354b1b8d181fd103edcfff3b7b4c7bbf44b9ec;hpb=ab52e5aeafdda3721a3843f489f2c43c05c45033;p=utcp diff --git a/utcp.c b/utcp.c index f2354b1..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. @@ -1294,7 +1296,7 @@ int utcp_shutdown(struct utcp_connection *c, int dir) { } int utcp_close(struct utcp_connection *c) { - if(utcp_shutdown(c, SHUT_RDWR)) + if(utcp_shutdown(c, SHUT_RDWR) && errno != ENOTCONN) return -1; c->recv = NULL; c->poll = NULL;