fnet.c

Simple C networking library
git clone git://git.finwo.net/lib/fnet.c
Log | Files | Refs | README

commit 280593786a4446d195e255b6062b0a909ae11d5b
parent 11df440e30877f8381f9284289dcf4b753e2f800
Author: Yersa Nordman <yersa@finwo.nl>
Date:   Wed,  2 Aug 2023 00:57:12 +0200

Close connection on free

Diffstat:
Msrc/fnet.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/fnet.c b/src/fnet.c @@ -425,8 +425,12 @@ FNET_RETURNCODE fnet_close(const struct fnet_t *connection) { .buffer = NULL, .udata = conn->ext.udata, })); + + conn->ext.onClose = NULL; } + // TODO: set closed flag + return FNET_RETURNCODE_OK; } @@ -444,7 +448,7 @@ FNET_RETURNCODE fnet_free(struct fnet_t *connection) { if (conn->prev) ((struct fnet_internal_t *)(conn->prev))->next = conn->next; if (conn == connections) connections = conn->next; - // TODO: check if the connections are closed? + fnet_close(conn); if (conn->fds) free(conn->fds);