1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

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.
This commit is contained in:
Josiah VanderZee 2025-05-22 17:03:11 -05:00 committed by sfan5
parent e9b32843a5
commit fa0c09d202

View file

@ -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();