1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fixes and cleanup of game client network shutdown and restart

This commit is contained in:
Ivan Savenko
2024-02-03 19:08:45 +02:00
parent 6eef197cea
commit 2c2bec791c
17 changed files with 102 additions and 146 deletions

View File

@@ -31,7 +31,8 @@ void GlobalLobbyProcessor::onDisconnected(const std::shared_ptr<INetworkConnecti
{
if (connection == controlConnection)
{
throw std::runtime_error("Lost connection to a lobby server!");
owner.setState(EServerState::SHUTDOWN);
return;
}
else
{
@@ -68,7 +69,7 @@ void GlobalLobbyProcessor::receiveOperationFailed(const JsonNode & json)
{
logGlobal->info("Lobby: Failed to login into a lobby server!");
throw std::runtime_error("Failed to login into a lobby server!");
owner.setState(EServerState::SHUTDOWN);
}
void GlobalLobbyProcessor::receiveLoginSuccess(const JsonNode & json)
@@ -91,7 +92,7 @@ void GlobalLobbyProcessor::receiveAccountJoinsRoom(const JsonNode & json)
void GlobalLobbyProcessor::onConnectionFailed(const std::string & errorMessage)
{
throw std::runtime_error("Failed to connect to a lobby server!");
owner.setState(EServerState::SHUTDOWN);
}
void GlobalLobbyProcessor::onConnectionEstablished(const std::shared_ptr<INetworkConnection> & connection)