From d1cd336ccd852ffaaa707f61ae69167b48582d66 Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sat, 4 May 2024 20:11:37 +0200 Subject: [PATCH] accept() can return an error --- dc11.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dc11.cpp b/dc11.cpp index 47d421b..fe89706 100644 --- a/dc11.cpp +++ b/dc11.cpp @@ -117,13 +117,15 @@ void dc11::operator()() } pfds[client_i].fd = accept(pfds[i].fd, nullptr, nullptr); - set_nodelay(pfds[client_i].fd); + if (pfds[client_i].fd != -1) { + set_nodelay(pfds[client_i].fd); - std::unique_lock lck(input_lock[i]); + std::unique_lock lck(input_lock[i]); - registers[i * 4 + 0] |= 0160000; // "ERROR", RING INDICATOR, CARRIER TRANSITION - if (is_rx_interrupt_enabled(i)) - trigger_interrupt(i); + registers[i * 4 + 0] |= 0160000; // "ERROR", RING INDICATOR, CARRIER TRANSITION + if (is_rx_interrupt_enabled(i)) + trigger_interrupt(i); + } } // receive data