From b4e6d4bac314221a8bdb522daef24b606f143cee Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Tue, 2 Dec 2014 17:14:13 +0100 Subject: [PATCH] Disable callbacks when closing a connection. When an application calls utcp_close() on a previously established connection, the utcp_connection is kept around to handle FIN(ACK) packets. However, the peer could still send some data, which should not trigger the receive callback. --- utcp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/utcp.c b/utcp.c index a79304c..391706f 100644 --- a/utcp.c +++ b/utcp.c @@ -930,6 +930,8 @@ int utcp_shutdown(struct utcp_connection *c, int dir) { int utcp_close(struct utcp_connection *c) { if(utcp_shutdown(c, SHUT_RDWR)) return -1; + c->recv = NULL; + c->poll = NULL; c->reapable = true; return 0; } @@ -946,6 +948,8 @@ int utcp_abort(struct utcp_connection *c) { return -1; } + c->recv = NULL; + c->poll = NULL; c->reapable = true; switch(c->state) { -- 2.39.2