From b2fc1d69435b7733551288c216ce4dcb768311b4 Mon Sep 17 00:00:00 2001 From: trompetin17 Date: Mon, 14 Jul 2025 12:30:32 -0500 Subject: [PATCH] DapInterface: shutdown sockets on Unix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FreeBSD could hang indefinitely when the debug-adapter process terminated because we closed the TCP socket without first calling `shutdown()`. On that platform (and similarly on Linux and macOS) a peer that is still blocked in `recv` will not be woken up unless a full‐duplex shutdown is performed. This patch adds `shutdown(fd, SHUT_RDWR)` in `DapInterface.cpp` for Linux, *BSD, and macOS builds, preventing the observed hang. --- source/dapinterface/DapInterface.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/dapinterface/DapInterface.cpp b/source/dapinterface/DapInterface.cpp index bee1487757..d1652e746e 100644 --- a/source/dapinterface/DapInterface.cpp +++ b/source/dapinterface/DapInterface.cpp @@ -258,9 +258,7 @@ namespace DAP } if (m_ServerSocket != -1) { -#if OS_LINUX shutdown(m_ServerSocket, SHUT_RDWR); -#endif close(m_ServerSocket); m_ServerSocket = -1; }