1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00: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:
Josiah VanderZee 2025-05-22 17:02:22 -05:00 committed by sfan5
parent 1214a1d4a6
commit e9b32843a5

View file

@ -12,6 +12,7 @@
#include "util/numeric.h" #include "util/numeric.h"
#include "porting.h" #include "porting.h"
#include "network/networkprotocol.h" #include "network/networkprotocol.h"
#include <atomic>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <memory> #include <memory>
@ -301,7 +302,7 @@ private:
// Backwards compatibility // Backwards compatibility
PeerHandler *m_bc_peerhandler; PeerHandler *m_bc_peerhandler;
bool m_shutting_down = false; std::atomic<bool> m_shutting_down = false;
}; };
} // namespace } // namespace