Fix EINTR handling for close

This commit is contained in:
2025-08-23 20:14:24 -04:00
parent 7db0e331e4
commit 18a1b30d9f
6 changed files with 86 additions and 78 deletions

View File

@@ -28,14 +28,12 @@ Connection::~Connection() {
if (auto server_ptr = server_.lock()) {
server_ptr->active_connections_.fetch_sub(1, std::memory_order_relaxed);
}
int e;
do {
e = close(fd_);
} while (e == -1 && errno == EINTR);
if (e == -1) {
int e = close(fd_);
if (e == -1 && errno != EINTR) {
perror("close");
std::abort();
}
// EINTR ignored - fd is guaranteed closed on Linux
}
void Connection::appendMessage(std::string_view s, bool copy_to_arena) {