From cab382db088d9f240253466a1c5a26c62f3967c8 Mon Sep 17 00:00:00 2001 From: justanothercatgirl Date: Sat, 8 Feb 2025 22:13:52 +0300 Subject: Implemented multiplexing in main thread (TCP loop). Removed CMake files. TODO: Implement multiplexing in worker threads (UDP loops), implement channel_pool interface. --- server/main.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'server/main.c') diff --git a/server/main.c b/server/main.c index b6745e0..0d8d9f3 100644 --- a/server/main.c +++ b/server/main.c @@ -3,6 +3,7 @@ #define HSET_MAX_BUCKET_SIZE 4 #include #undef CONTAINER_IMPLEMENTATION +#include #include "tcp.h" @@ -11,22 +12,18 @@ #define MAIN_PORT 8164 void setup_signal(void) { - struct sigaction signal = {.sa_handler = print_state, .sa_mask = {{0}}, .sa_flags = 0}; - if (sigaction(SIGUSR1, &signal, NULL) != 0) { - WHERE; - exit(EXIT_FAILURE); - } + struct sigaction signal = {.sa_handler = print_state, .sa_mask = {{0}}, .sa_flags = SA_RESTART}; + if (sigaction(SIGUSR1, &signal, NULL) != 0) LFAILV("sigaction"); signal.sa_handler = exit_tcp; - if (sigaction(SIGTERM, &signal, NULL) != 0) { - WHERE; - exit(EXIT_FAILURE); - } + if (sigaction(SIGTERM, &signal, NULL) != 0) LFAILV("sigaction"); } int main(int argc, char *argv[]) { (void)argc; (void)argv; setup_signal(); - tcp_loop(); + new_tcp_loop(); return 0; } + +/* vim: set ts=8 noet: */ -- cgit v1.2.3-70-g09d2