Merge pull request #1219 from DarkflameUniverse/lol

fix: Address race condition
This commit is contained in:
Gie "Max" Vanommeslaeghe 2023-10-19 12:25:27 +02:00 committed by GitHub
commit 4c507e34a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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