mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-24 22:11:04 +00:00
Stop handling the current packet if the server is shutting down
Previously, terminating a running server from the terminal would sometimes print a benign warning message if the server was currently handling an incoming packet. This happened because CNServer::step() would continue handling the packet after CNServer::kill() released the activeCrit mutex. Now it first re-checks if active has been set to false in the mean time after acquiring the mutex.
This commit is contained in:
parent
2914b95cff
commit
7aabc507e7
@ -473,6 +473,10 @@ void CNServer::start() {
|
||||
} else {
|
||||
std::lock_guard<std::mutex> lock(activeCrit); // protect operations on connections
|
||||
|
||||
// halt packet handling if server is shutting down
|
||||
if (!active)
|
||||
return;
|
||||
|
||||
// player sockets
|
||||
if (connections.find(fds[i].fd) == connections.end()) {
|
||||
std::cout << "[WARN] Event on non-existant socket?" << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user