http-server.c

Basic HTTP server and router in C
git clone git://git.finwo.net/lib/http-server.c
Log | Files | Refs | README

commit db500a5de62e41525e3eca40529c563533b59309
parent 97ec78d1e268f68e9971444afa7735994a32ede7
Author: Yersa Nordman <yersa@finwo.nl>
Date:   Thu, 26 Oct 2023 22:36:50 +0200

Don't re-listen while shutting down

Diffstat:
Msrc/http-server.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/http-server.c b/src/http-server.c @@ -142,7 +142,9 @@ void http_server_route(const char *method, const char *path, void (*fn)(struct h void _hs_onListenClose(struct fnet_ev *ev) { struct fnet_udata *ludata = ev->udata; - ludata->opts->listen_connection = fnet_listen(ludata->opts->addr, ludata->opts->port, ludata->fnet_opts); + if (!ludata->opts->shutdown) { + ludata->opts->listen_connection = fnet_listen(ludata->opts->addr, ludata->opts->port, ludata->fnet_opts); + } } void _thread_network(void *arg) {