1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Ignore duplicate disconnected calls

This commit is contained in:
Ivan Savenko 2024-05-16 07:55:33 +00:00
parent f963b827e9
commit aadbf6dd6a

View File

@ -40,26 +40,26 @@ void GlobalLobbyProcessor::onDisconnected(const std::shared_ptr<INetworkConnecti
}
else
{
if (owner.getState() == EServerState::LOBBY)
for (auto const & proxy : proxyConnections)
{
for (auto const & proxy : proxyConnections)
if (proxy.second != connection)
continue;
if (owner.getState() == EServerState::LOBBY)
{
if (proxy.second == connection)
{
JsonNode message;
message["type"].String() = "leaveGameRoom";
message["accountID"].String() = proxy.first;
JsonNode message;
message["type"].String() = "leaveGameRoom";
message["accountID"].String() = proxy.first;
sendMessage(controlConnection, message);
proxyConnections.erase(proxy.first);
break;
}
sendMessage(controlConnection, message);
}
}
// player disconnected
owner.onDisconnected(connection, errorMessage);
proxyConnections.erase(proxy.first);
// player disconnected
owner.onDisconnected(connection, errorMessage);
return;
}
}
}