X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Futcp.c;h=ec74923dd128a85c4b730fefa015127e40a40c8a;hb=21e47177687ac553303005941b971092e973575a;hp=d2a929bf734a598b51ff8d2dd309b08c3383516c;hpb=f13b47a184094c6c9c22faf22c4e6b1117a1d758;p=meshlink diff --git a/src/utcp.c b/src/utcp.c index d2a929bf..ec74923d 100644 --- a/src/utcp.c +++ b/src/utcp.c @@ -423,7 +423,6 @@ static int compare(const void *va, const void *vb) { const struct utcp_connection *b = *(struct utcp_connection **)vb; assert(a && b); - assert(a->src && b->src); int c = (int)a->src - (int)b->src; @@ -2052,6 +2051,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; }