Merge pull request 'Fix logic/correctness bugs (#73, #68, #67, #66, #59, #58, #54, #48, #53)' (#82) from fix/logic-correctness into main
CI / lint (push) Failing after 8s
CI / build-and-test (push) Has been skipped
CI / sanitizers (address) (push) Has been skipped
CI / sanitizers (undefined) (push) Has been skipped
CI / fuzz-build (push) Has been skipped
CI / coverage (push) Has been skipped
CI / valgrind (push) Has been skipped

This commit was merged in pull request #82.
This commit is contained in:
2026-07-20 19:05:02 +02:00
9 changed files with 159 additions and 55 deletions
+8 -4
View File
@@ -113,13 +113,11 @@ void handler(int file_descriptor) {
}
static Server* g_server = NULL;
static volatile sig_atomic_t g_server_cleanup_requested = 0;
static void cleanup(int sig) {
(void)sig;
if (g_server) {
server_delete(&g_server);
}
_exit(0);
g_server_cleanup_requested = 1;
}
static void print_server_usage(void) {
@@ -209,5 +207,11 @@ int main(int argc, char* argv[]) {
} else {
server_listen(g_server, handler);
}
/* Graceful shutdown: if a signal requested cleanup, delete the server */
if (g_server_cleanup_requested) {
log_message(LOG_LEVEL_INFO, "Shutdown requested, cleaning up");
server_delete(&g_server);
}
return 0;
}