From 2c8d853af0915aac994cbd16be881197479ee092 Mon Sep 17 00:00:00 2001 From: "Aleksei (Faumaray) Selikhov" Date: Thu, 3 Dec 2026 17:37:14 +0300 Subject: [PATCH] Net: consume read/write/send results in the HTTP server (VL-NET-W01) --- src/Net/HttpServer.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Net/HttpServer.cpp b/src/Net/HttpServer.cpp index 203444a..343bbc8 100644 --- a/src/Net/HttpServer.cpp +++ b/src/Net/HttpServer.cpp @@ -2516,7 +2516,11 @@ namespace Void::Net } if ((pfds[1].revents & POLLIN) != 0) { std::uint64_t val = 0; - (void)::read(wake_fd, &val, sizeof(val)); + // Best effort: the eventfd is only a wakeup hint and the + // stopping flag is authoritative, but consume the result so + // fortified headers do not raise -Wunused-result. + [[maybe_unused]] const ssize_t drained = + ::read(wake_fd, &val, sizeof(val)); } if (stopping.load(std::memory_order_acquire)) { break; @@ -2555,8 +2559,11 @@ namespace Void::Net "Content-Length: 19\r\n" "Connection: close\r\n\r\n" "Service Unavailable"; - (void)::send(client_fd, busy.data(), busy.size(), - MSG_NOSIGNAL); + // The connection is closed regardless of whether the + // 503 could be delivered; consume the result explicitly. + [[maybe_unused]] const ssize_t sent = + ::send(client_fd, busy.data(), busy.size(), + MSG_NOSIGNAL); (void)::close(client_fd); continue; } @@ -2590,7 +2597,10 @@ namespace Void::Net stopping.store(true, std::memory_order_release); if (wake_fd >= 0) { const std::uint64_t one = 1; - (void)::write(wake_fd, &one, sizeof(one)); + // Best effort wakeup: the accept loop also polls with a + // timeout, so a full eventfd cannot delay shutdown. + [[maybe_unused]] const ssize_t signalled = + ::write(wake_fd, &one, sizeof(one)); } if (accept_thread.joinable()) { accept_thread.join();