mirror of
				https://github.com/luanti-org/luanti.git
				synced 2025-10-31 15:35:21 +01:00 
			
		
		
		
	Make MTP server shutdown flag atomic
I noticed this potential data race while reading the code. I have not detected it with TSan in practice.
This commit is contained in:
		| @@ -12,6 +12,7 @@ | ||||
| #include "util/numeric.h" | ||||
| #include "porting.h" | ||||
| #include "network/networkprotocol.h" | ||||
| #include <atomic> | ||||
| #include <iostream> | ||||
| #include <vector> | ||||
| #include <memory> | ||||
| @@ -301,7 +302,7 @@ private: | ||||
| 	// Backwards compatibility
 | ||||
| 	PeerHandler *m_bc_peerhandler; | ||||
| 
 | ||||
| 	bool m_shutting_down = false; | ||||
| 	std::atomic<bool> m_shutting_down = false; | ||||
| }; | ||||
| 
 | ||||
| } // namespace
 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user