mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-11-04 09:15:29 +01: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:
		@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user