diff --git a/src/Net/module.cmake b/src/Net/module.cmake index 5cffbd2..7708572 100644 --- a/src/Net/module.cmake +++ b/src/Net/module.cmake @@ -9,3 +9,13 @@ void_add_module(Net OpenSSL::Crypto Threads::Threads ) + +if(VOID_ENABLE_TSAN AND TARGET Void_Net) + # Boost.Asio 1.84's std_fenced_block calls std::atomic_thread_fence, which + # GCC warns is unsupported under -fsanitize=thread (-Werror=tsan). Keep + # hardware fences intact and scope the diagnostic suppression solely to + # Http.cpp so HttpServer.cpp and all other TUs keep full -Werror=tsan. + set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/Http.cpp" + PROPERTIES COMPILE_OPTIONS "$<$:-Wno-tsan>" + ) +endif() diff --git a/tests/standalone/Net/HttpClient.cpp b/tests/standalone/Net/HttpClient.cpp index 453ba3f..ba23c8b 100644 --- a/tests/standalone/Net/HttpClient.cpp +++ b/tests/standalone/Net/HttpClient.cpp @@ -273,8 +273,9 @@ Void::Testing::Test http_client_timeout_bounds_a_stalled_server() ~StallServer() { - if (conn >= 0) ::close(conn); + if (fd >= 0) ::shutdown(fd, SHUT_RDWR); if (worker.joinable()) worker.join(); + if (conn >= 0) ::close(conn); if (fd >= 0) ::close(fd); } };