Fix the issue where we would create new worlds on ports that were still being used (#625)

* Wait for world to shutdown

We need to wait for the message that the world has shutdown before shutting it down.

* Dont sent people to dead instances

* Added shutting down check

Added check for isShuttingDown

* Update when we remove from master
This commit is contained in:
David Markowitz
2022-07-18 16:08:33 -07:00
committed by GitHub
parent ef8c2a40f3
commit b55606d41e
3 changed files with 10 additions and 5 deletions

View File

@@ -311,7 +311,7 @@ int main(int argc, char** argv) {
if (affirmTimeout == 1000) {
instance->Shutdown();
instance->SetShutdownComplete(true);
instance->SetIsShuttingDown(true);
Game::im->RedirectPendingRequests(instance);
}
@@ -358,6 +358,7 @@ void HandlePacket(Packet* packet) {
Instance* instance =
Game::im->GetInstanceBySysAddr(packet->systemAddress);
if (instance) {
Game::logger->Log("MasterServer", "Actually disconnected from zone %i clone %i instance %i port %i\n", instance->GetMapID(), instance->GetCloneID(), instance->GetInstanceID(), instance->GetPort());
Game::im->RemoveInstance(instance); //Delete the old
}
@@ -694,8 +695,8 @@ void HandlePacket(Packet* packet) {
return;
}
Game::logger->Log("MasterServer", "Got shutdown response\n");
instance->SetShutdownComplete(true);
Game::logger->Log("MasterServer", "Got shutdown response from zone %i clone %i instance %i port %i\n", instance->GetMapID(), instance->GetCloneID(), instance->GetInstanceID(), instance->GetPort());
instance->SetIsShuttingDown(true);
break;
}