mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-12-22 21:43:35 +00:00
Sped up server shutdown
This commit is contained in:
parent
5ef1848474
commit
fd13770e87
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -522,10 +522,6 @@ int main(int argc, char** argv) {
|
||||
CBITSTREAM;
|
||||
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_SHUTDOWN_RESPONSE);
|
||||
Game::server->SendToMaster(&bitStream);
|
||||
}
|
||||
|
||||
if (framesSinceShutdownSequence == 300)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user