X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;ds=sidebyside;f=src%2Futcp.c;fp=src%2Futcp.c;h=fa45e9c625b4b4e1d28c07ea49d881dad40e2107;hb=32ab3f06ce82167e2670bd9c7c58a0c21a2550c2;hp=11a9eead2960ae33a7523280c950da26970b3ef4;hpb=526dafffcaee26fb715e603b115964b0b080e2b0;p=meshlink diff --git a/src/utcp.c b/src/utcp.c index 11a9eead..fa45e9c6 100644 --- a/src/utcp.c +++ b/src/utcp.c @@ -1600,6 +1600,8 @@ synack: // The peer has aborted our connection. set_state(c, CLOSED); errno = ECONNRESET; + buffer_clear(&c->sndbuf); + buffer_clear(&c->rcvbuf); if(c->recv) { c->recv(c, NULL, 0); @@ -2208,6 +2210,8 @@ struct timespec utcp_timeout(struct utcp *utcp) { if(timespec_isset(&c->conn_timeout) && timespec_lt(&c->conn_timeout, &now)) { errno = ETIMEDOUT; c->state = CLOSED; + buffer_clear(&c->sndbuf); + buffer_clear(&c->rcvbuf); if(c->recv) { c->recv(c, NULL, 0); @@ -2310,6 +2314,9 @@ void utcp_exit(struct utcp *utcp) { struct utcp_connection *c = utcp->connections[i]; if(!c->reapable) { + buffer_clear(&c->sndbuf); + buffer_clear(&c->rcvbuf); + if(c->recv) { c->recv(c, NULL, 0); }