mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 02:46:49 +00:00
Erase client state hash on disconnect
Fix `NetServerTurnManager` from pausing the simulation forever after a client sent a bad hash to it and disconnects before the bad hash has been processed. A client that sends a wrong simulation hash to the `NetServer` and disconnects before the server compares that hash causes a message box to appear and the game to be paused forever.94e5d88169introduced the bug by missing to delete `m_ClientStateHashes upon `UninitialiseClient. This causes `m_ClientData[hashPair.first].isOOS = true` to insert a client with blank values that the `NetServerTurnManager` will wait forever and hence the message box about an OOS with no players being OOS is shown (the playername is emptystring).5ebf2020b0exposed the bug by making observers able to lag behind, providing a longe enough timeframe for this to occur. Fix: Deleting `m_ClientStateHashes` upon disconnect solves the broken message box and the pausing. (cherry picked from commitd12c015d43) Signed-off-by: Itms <itms@wildfiregames.com>
This commit is contained in:
@@ -200,6 +200,9 @@ void CNetServerTurnManager::UninitialiseClient(int client)
|
||||
bool checkOOS = m_ClientsData[client].isOOS;
|
||||
m_ClientsData.erase(client);
|
||||
|
||||
for (std::pair<const u32, std::map<int, std::string>>& clientStateHash : m_ClientStateHashes)
|
||||
clientStateHash.second.erase(client);
|
||||
|
||||
// Check whether we're ready for the next turn now that we're not
|
||||
// waiting for this client any more
|
||||
CheckClientsReady();
|
||||
|
||||
Reference in New Issue
Block a user