From: Guus Sliepen Date: Mon, 18 May 2020 21:22:06 +0000 (+0200) Subject: Reset closed connections if there is incoming data. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=93dfd8a6689a3f176d460bd757a466b61b29181d;p=meshlink Reset closed connections if there is incoming data. --- diff --git a/src/utcp.c b/src/utcp.c index d2a929bf..f81150bf 100644 --- a/src/utcp.c +++ b/src/utcp.c @@ -2052,6 +2052,11 @@ void utcp_abort_all_connections(struct utcp *utcp) { } int utcp_close(struct utcp_connection *c) { + if(c->rcvbuf.used) { + fprintf(stderr, "UTCP channel closed with stuff in receive buffer\n"); + return reset_connection(c) ? 0 : -1; + } + if(utcp_shutdown(c, SHUT_RDWR) && errno != ENOTCONN) { return -1; }