Master: Address race condition

Fix a race condition that would overwrite the port of zone 0 with the auth server port or a chat server port which would cause a domino effect of desynced server ports

Tested that a sleep(5) in auth still allows a player to connect and login without issues
This commit is contained in:
David Markowitz 2023-10-14 00:01:41 -07:00
parent c6087ce77a
commit 2746683235

View File

@ -581,7 +581,8 @@ void HandlePacket(Packet* packet) {
inStream.Read(theirServerType);
theirIP = PacketUtils::ReadString(24, packet, false); //24 is the current offset
if (theirServerType == ServerType::World && !Game::im->IsPortInUse(theirPort)) {
if (theirServerType == ServerType::World) {
if (!Game::im->IsPortInUse(theirPort)) {
Instance* in = new Instance(theirIP, theirPort, theirZoneID, theirInstanceID, 0, 12, 12);
SystemAddress copy;
@ -597,6 +598,7 @@ void HandlePacket(Packet* packet) {
instance->SetSysAddr(packet->systemAddress);
}
}
}
if (theirServerType == ServerType::Chat) {
SystemAddress copy;