From fa0c09d202537acbd267a38958f16c883359baca Mon Sep 17 00:00:00 2001 From: Josiah VanderZee Date: Thu, 22 May 2025 17:03:11 -0500 Subject: [PATCH] Do not modify peer timeout on shutdown Shortening the peer timeout was supposedly necessary at some point to work around an unknown bug. I was not able to reproduce the bug running a headless Luanti server on WSL Tumbleweed and connecting with a client on the Windows host. That is not enough to say the issue no longer exists. This commit may cause a regression. The access to change the peer timeout was unsynchronized and done by a different thread than the sending thread, so it was detected by TSan to be a data race. Since this patch deletes the code performing the write, the data race is no longer a concern and no synchronization must be added. --- src/network/mtp/impl.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/network/mtp/impl.cpp b/src/network/mtp/impl.cpp index 07bdfc735..d54c116a2 100644 --- a/src/network/mtp/impl.cpp +++ b/src/network/mtp/impl.cpp @@ -1314,11 +1314,6 @@ Connection::~Connection() m_sendThread->stop(); m_receiveThread->stop(); - //TODO for some unkonwn reason send/receive threads do not exit as they're - // supposed to be but wait on peer timeout. To speed up shutdown we reduce - // timeout to half a second. - m_sendThread->setPeerTimeout(0.5); - // wait for threads to finish m_sendThread->wait(); m_receiveThread->wait();