From 93dfd8a6689a3f176d460bd757a466b61b29181d Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 18 May 2020 23:22:06 +0200 Subject: [PATCH] Reset closed connections if there is incoming data. --- src/utcp.c | 5 +++++ 1 file changed, 5 insertions(+) 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; } -- 2.39.5