From 6c305576662fd00649a0a23c9b4b1e858f6bd5e2 Mon Sep 17 00:00:00 2001 From: TapTap Date: Mon, 20 Jul 2026 20:10:07 +0200 Subject: [PATCH] fix: break accept loop on EINTR so server shuts down on SIGTERM --- src/shared/transport_tcp.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/shared/transport_tcp.c b/src/shared/transport_tcp.c index c06278b..4a90bd1 100644 --- a/src/shared/transport_tcp.c +++ b/src/shared/transport_tcp.c @@ -2,6 +2,7 @@ #include "log.h" #include "protocol.h" #include +#include #include #include #include @@ -74,6 +75,8 @@ static void accept_loop(Server* server, void (*child_fn)(int, void*), void* chil socklen_t client_len = sizeof(client_addr); int fd = accept(server->file_descriptor, (struct sockaddr*)&client_addr, &client_len); if (fd < 0) { + if (errno == EINTR) + break; perror("Could not accept the connection"); continue; }