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

Fixed handling of match server crash

This commit is contained in:
Ivan Savenko
2024-02-04 19:56:04 +02:00
parent 7dee24edae
commit d4bedd8d8d
10 changed files with 69 additions and 81 deletions

View File

@@ -54,7 +54,6 @@ enum class EClientState : ui8
STARTING, // Gameplay interfaces being created, we pause netpacks retrieving
GAMEPLAY, // In-game, used by some UI
DISCONNECTING, // We disconnecting, drop all netpacks
CONNECTION_FAILED // We could not connect to server
};
enum class EServerMode : uint8_t
@@ -108,6 +107,8 @@ class CServerHandler final : public IServerAPI, public LobbyInfo, public INetwor
boost::thread threadRunLocalServer;
boost::thread threadNetwork;
std::atomic<EClientState> state;
void threadRunNetwork();
void threadRunServer(bool connectToLobby);
@@ -129,7 +130,6 @@ class CServerHandler final : public IServerAPI, public LobbyInfo, public INetwor
public:
std::shared_ptr<CConnection> c;
std::atomic<EClientState> state;
////////////////////
// FIXME: Bunch of crutches to glue it all together
@@ -160,6 +160,9 @@ public:
bool isMyColor(PlayerColor color) const;
ui8 myFirstId() const; // Used by chat only!
EClientState getState() const;
void setState(EClientState newState);
bool isHost() const;
bool isGuest() const;