Sped up server shutdown

This commit is contained in:
EmosewaMC
2022-04-09 14:17:31 -07:00
parent 5ef1848474
commit fd13770e87
2 changed files with 10 additions and 4 deletions

View File

@@ -751,6 +751,14 @@ void ShutdownSequence() {
Game::logger->Log("MasterServer", "Attempting to shutdown instances, max 60 seconds...\n");
while (true) {
auto packet = Game::server->Receive();
if (packet) {
HandlePacket(packet);
Game::server->DeallocatePacket(packet);
packet = nullptr;
}
auto done = true;
for (auto* instance : Game::im->GetInstances()) {
@@ -764,6 +772,7 @@ void ShutdownSequence() {
}
if (done) {
Game::logger->Log("MasterServer", "Finished shutting down naturally!\n");
break;
}
@@ -773,6 +782,7 @@ void ShutdownSequence() {
ticks++;
if (ticks == 600 * 6) {
Game::logger->Log("MasterServer", "Finished shutting down by timeout!\n");
break;
}
}