Ticket #3907: network_cleanup.patch
File network_cleanup.patch, 23.2 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/common/network.js
172 172 { 173 173 // Remove outdated messages 174 174 for (let guid in g_NetworkWarnings) 175 {176 if (Date.now() > g_NetworkWarnings[guid].added + g_NetworkWarningTimeout)175 if (Date.now() > g_NetworkWarnings[guid].added + g_NetworkWarningTimeout || 176 guid != "server" && !g_PlayerAssignments[guid]) 177 177 delete g_NetworkWarnings[guid]; 178 178 179 if (guid != "server" && !g_PlayerAssignments[guid])180 delete g_NetworkWarnings[guid];181 }182 183 179 // Show local messages first 184 180 let guids = Object.keys(g_NetworkWarnings).sort(guid => guid != "server"); 185 181 -
source/network/NetClient.cpp
140 140 141 141 void CNetClient::TraceMember(JSTracer *trc) 142 142 { 143 std::deque<JS::Heap<JS::Value> >::iterator itr; 144 for (itr=m_GuiMessageQueue.begin(); itr != m_GuiMessageQueue.end(); ++itr) 145 JS_CallHeapValueTracer(trc, &*itr, "m_GuiMessageQueue"); 143 for (JS::Heap<JS::Value>& guiMessage : m_GuiMessageQueue) 144 JS_CallHeapValueTracer(trc, &guiMessage, "m_GuiMessageQueue"); 146 145 } 147 146 148 147 void CNetClient::SetUserName(const CStrW& username) … … 278 277 JS::RootedValue hosts(cx); 279 278 GetScriptInterface().GetProperty(msg, "hosts", &hosts); 280 279 281 for ( PlayerAssignmentMap::iterator it = m_PlayerAssignments.begin(); it != m_PlayerAssignments.end(); ++it)280 for (const std::pair<CStr, PlayerAssignment>& p : m_PlayerAssignments) 282 281 { 283 282 JS::RootedValue host(cx); 284 283 GetScriptInterface().Eval("({})", &host); 285 GetScriptInterface().SetProperty(host, "name", std::wstring( it->second.m_Name), false);286 GetScriptInterface().SetProperty(host, "player", it->second.m_PlayerID, false);287 GetScriptInterface().SetProperty(host, "status", it->second.m_Status, false);288 GetScriptInterface().SetProperty(hosts, it->first.c_str(), host, false);284 GetScriptInterface().SetProperty(host, "name", std::wstring(p.second.m_Name), false); 285 GetScriptInterface().SetProperty(host, "player", p.second.m_PlayerID, false); 286 GetScriptInterface().SetProperty(host, "status", p.second.m_Status, false); 287 GetScriptInterface().SetProperty(hosts, p.first.c_str(), host, false); 289 288 } 290 289 291 290 PushGuiMessage(msg); … … 709 708 return true; 710 709 711 710 CClientPerformanceMessage* message = (CClientPerformanceMessage*)event->GetParamRef(); 712 std::vector<CClientPerformanceMessage::S_m_Clients> &clients = message->m_Clients;713 711 714 712 // Display warnings for other clients with bad ping 715 for (size_t i = 0; i < clients.size(); ++i)713 for (size_t i = 0; i < message->m_Clients.size(); ++i) 716 714 { 717 if ( clients[i].m_MeanRTT < DEFAULT_TURN_LENGTH_MP || clients[i].m_GUID == client->m_GUID)715 if (message->m_Clients[i].m_MeanRTT < DEFAULT_TURN_LENGTH_MP || message->m_Clients[i].m_GUID == client->m_GUID) 718 716 continue; 719 717 720 718 JS::RootedValue msg(cx); 721 719 client->GetScriptInterface().Eval("({ 'type':'netwarn', 'warntype': 'client-latency' })", &msg); 722 client->GetScriptInterface().SetProperty(msg, "guid", clients[i].m_GUID);723 client->GetScriptInterface().SetProperty(msg, "meanRTT", clients[i].m_MeanRTT);720 client->GetScriptInterface().SetProperty(msg, "guid", message->m_Clients[i].m_GUID); 721 client->GetScriptInterface().SetProperty(msg, "meanRTT", message->m_Clients[i].m_MeanRTT); 724 722 client->PushGuiMessage(msg); 725 723 } 726 724 -
source/network/NetClient.h
249 249 CStr m_GUID; 250 250 251 251 /// Queue of messages for GuiPoll 252 std::deque<JS::Heap<JS::Value> 252 std::deque<JS::Heap<JS::Value>> m_GuiMessageQueue; 253 253 254 254 /// Serialized game state received when joining an in-progress game 255 255 std::string m_JoinSyncBuffer; -
source/network/NetFileTransfer.cpp
1 /* Copyright (C) 2016 Wildfire Games. 2 * This file is part of 0 A.D. 3 * 4 * 0 A.D. is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * 0 A.D. is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 1 18 #include "precompiled.h" 2 19 3 20 #include "NetFileTransfer.h" … … 141 158 { 142 159 // Find tasks which have fewer packets in flight than their window size, 143 160 // and send more packets 144 for ( FileSendTasksMap::iterator it = m_FileSendTasks.begin(); it != m_FileSendTasks.end(); ++it)161 for (std::pair<const u32, CNetFileSendTask>& p : m_FileSendTasks) 145 162 { 146 while (it->second.packetsInFlight < it->second.maxWindowSize && it->second.offset < it->second.buffer.size()) 163 CNetFileSendTask& task = p.second; 164 165 while (task.packetsInFlight < task.maxWindowSize && task.offset < task.buffer.size()) 147 166 { 148 167 CFileTransferDataMessage dataMessage; 149 dataMessage.m_RequestID = it->second.requestID;150 ssize_t packetSize = std::min(DEFAULT_FILE_TRANSFER_PACKET_SIZE, it->second.buffer.size() - it->second.offset);151 dataMessage.m_Data = it->second.buffer.substr(it->second.offset, packetSize);152 it->second.offset += packetSize;153 it->second.packetsInFlight++;168 dataMessage.m_RequestID = task.requestID; 169 ssize_t packetSize = std::min(DEFAULT_FILE_TRANSFER_PACKET_SIZE, task.buffer.size() - task.offset); 170 dataMessage.m_Data = task.buffer.substr(task.offset, packetSize); 171 task.offset += packetSize; 172 ++task.packetsInFlight; 154 173 m_Session->SendMessage(&dataMessage); 155 174 } 156 175 } -
source/network/NetFileTransfer.h
1 /* Copyright (C) 201 1Wildfire Games.1 /* Copyright (C) 2016 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 121 121 122 122 u32 m_NextRequestID; 123 123 124 typedef std::map<u32, shared_ptr<CNetFileReceiveTask> 124 typedef std::map<u32, shared_ptr<CNetFileReceiveTask>> FileReceiveTasksMap; 125 125 FileReceiveTasksMap m_FileReceiveTasks; 126 126 127 127 typedef std::map<u32, CNetFileSendTask> FileSendTasksMap; -
source/network/NetServer.cpp
90 90 91 91 // Find the session corresponding to the rejoining host (if any) 92 92 CNetServerSession* session = NULL; 93 for ( size_t i = 0; i < m_Server.m_Sessions.size(); ++i)93 for (CNetServerSession* serverSession : m_Server.m_Sessions) 94 94 { 95 if ( m_Server.m_Sessions[i]->GetHostID() == m_RejoinerHostID)95 if (serverSession->GetHostID() == m_RejoinerHostID) 96 96 { 97 session = m_Server.m_Sessions[i];97 session = serverSession; 98 98 break; 99 99 } 100 100 } … … 157 157 158 158 delete m_Stats; 159 159 160 for ( size_t i = 0; i < m_Sessions.size(); ++i)160 for (CNetServerSession* session : m_Sessions) 161 161 { 162 m_Sessions[i]->DisconnectNow(NDR_SERVER_SHUTDOWN);163 delete m_Sessions[i];162 session->DisconnectNow(NDR_SERVER_SHUTDOWN); 163 delete session; 164 164 } 165 165 166 166 if (m_Host) 167 {168 167 enet_host_destroy(m_Host); 169 }170 168 171 169 delete m_ServerTurnManager; 172 170 } … … 346 344 bool ok = true; 347 345 348 346 // Send to all sessions that are active and has finished authentication 349 for (size_t i = 0; i < m_Sessions.size(); ++i)350 {351 if (m_Sessions[i]->GetCurrState() == NSS_PREGAME || m_Sessions[i]->GetCurrState() == NSS_INGAME)352 {353 if (! m_Sessions[i]->SendMessage(message))347 // TODO: this does lots of repeated message serialisation if we have lots 348 // of remote peers; could do it more efficiently if that's a real problem 349 for (CNetServerSession* session : m_Sessions) 350 if (session->GetCurrState() == NSS_PREGAME || session->GetCurrState() == NSS_INGAME) 351 if (!session->SendMessage(message)) 354 352 ok = false; 355 353 356 // TODO: this does lots of repeated message serialisation if we have lots357 // of remote peers; could do it more efficiently if that's a real problem358 }359 }360 361 354 return ok; 362 355 } 363 356 … … 411 404 JSContext* cx = m_ScriptInterface->GetContext(); 412 405 JSAutoRequest rq(cx); 413 406 414 std::vector<std::pair<int, CStr> 407 std::vector<std::pair<int, CStr>> newAssignPlayer; 415 408 std::vector<bool> newStartGame; 416 std::vector<std::pair<CStr, int> 409 std::vector<std::pair<CStr, int>> newPlayerReady; 417 410 std::vector<bool> newPlayerResetReady; 418 411 std::vector<std::string> newGameAttributes; 419 412 std::vector<u32> newTurnLength; … … 432 425 newTurnLength.swap(m_TurnLengthQueue); 433 426 } 434 427 435 for ( size_t i = 0; i < newAssignPlayer.size(); ++i)436 AssignPlayer( newAssignPlayer[i].first, newAssignPlayer[i].second);428 for (const std::pair<int, CStr8>& p : newAssignPlayer) 429 AssignPlayer(p.first, p.second); 437 430 438 for ( size_t i = 0; i < newPlayerReady.size(); ++i)439 SetPlayerReady( newPlayerReady[i].first, newPlayerReady[i].second);431 for (const std::pair<CStr8, int>& p : newPlayerReady) 432 SetPlayerReady(p.first, p.second); 440 433 441 434 if (!newPlayerResetReady.empty()) 442 435 ClearAllPlayerReady(); … … 456 449 StartGame(); 457 450 458 451 // Perform file transfers 459 for ( size_t i = 0; i < m_Sessions.size(); ++i)460 m_Sessions[i]->GetFileTransferer().Poll();452 for (CNetServerSession* session : m_Sessions) 453 session->GetFileTransferer().Poll(); 461 454 462 455 CheckClientConnections(); 463 456 … … 635 628 } 636 629 637 630 // Update FSM 638 bool ok = session->Update(message->GetType(), (void*)message); 639 if (!ok) 631 if (!session->Update(message->GetType(), (void*)message)) 640 632 LOGERROR("Net server: Error running FSM update (type=%d state=%d)", (int)message->GetType(), (int)session->GetCurrState()); 641 633 } 642 634 … … 719 711 { 720 712 // Find all player IDs in active use; we mustn't give them to a second player (excluding the unassigned ID: -1) 721 713 std::set<i32> usedIDs; 722 for ( PlayerAssignmentMap::iterator it = m_PlayerAssignments.begin(); it != m_PlayerAssignments.end(); ++it)723 if ( it->second.m_Enabled && it->second.m_PlayerID != -1)724 usedIDs.insert( it->second.m_PlayerID);714 for (const std::pair<CStr, PlayerAssignment>& p : m_PlayerAssignments) 715 if (p.second.m_Enabled && p.second.m_PlayerID != -1) 716 usedIDs.insert(p.second.m_PlayerID); 725 717 726 718 // If the player is rejoining after disconnecting, try to give them 727 719 // back their old player ID … … 824 816 void CNetServerWorker::AssignPlayer(int playerID, const CStr& guid) 825 817 { 826 818 // Remove anyone who's already assigned to this player 827 for ( PlayerAssignmentMap::iterator it = m_PlayerAssignments.begin(); it != m_PlayerAssignments.end(); ++it)819 for (std::pair<const CStr, PlayerAssignment>& p : m_PlayerAssignments) 828 820 { 829 if ( it->second.m_PlayerID == playerID)830 it->second.m_PlayerID = -1;821 if (p.second.m_PlayerID == playerID) 822 p.second.m_PlayerID = -1; 831 823 } 832 824 833 825 // Update this host's assignment if it exists … … 839 831 840 832 void CNetServerWorker::ConstructPlayerAssignmentMessage(CPlayerAssignmentMessage& message) 841 833 { 842 for ( PlayerAssignmentMap::iterator it = m_PlayerAssignments.begin(); it != m_PlayerAssignments.end(); ++it)834 for (const std::pair<CStr, PlayerAssignment>& p : m_PlayerAssignments) 843 835 { 844 if (! it->second.m_Enabled)836 if (!p.second.m_Enabled) 845 837 continue; 846 838 847 839 CPlayerAssignmentMessage::S_m_Hosts h; 848 h.m_GUID = it->first;849 h.m_Name = it->second.m_Name;850 h.m_PlayerID = it->second.m_PlayerID;851 h.m_Status = it->second.m_Status;840 h.m_GUID = p.first; 841 h.m_Name = p.second.m_Name; 842 h.m_PlayerID = p.second.m_PlayerID; 843 h.m_Status = p.second.m_Status; 852 844 message.m_Hosts.push_back(h); 853 845 } 854 846 } … … 955 947 int disconnectedPlayers = 0; 956 948 int connectedPlayers = 0; 957 949 // (TODO: if GUIDs were stable, we should use them instead) 958 for ( PlayerAssignmentMap::iterator it = server.m_PlayerAssignments.begin(); it != server.m_PlayerAssignments.end(); ++it)950 for (const std::pair<CStr, PlayerAssignment>& p : server.m_PlayerAssignments) 959 951 { 960 if (!it->second.m_Enabled && it->second.m_Name == username) 952 const PlayerAssignment& assignment = p.second; 953 954 if (!assignment.m_Enabled && assignment.m_Name == username) 961 955 { 962 isObserver = it->second.m_PlayerID == -1;956 isObserver = assignment.m_PlayerID == -1; 963 957 isRejoining = true; 964 958 } 965 959 966 if ( it->second.m_PlayerID == -1)960 if (assignment.m_PlayerID == -1) 967 961 continue; 968 962 969 if ( it->second.m_Enabled)963 if (assignment.m_Enabled) 970 964 ++connectedPlayers; 971 965 else 972 966 ++disconnectedPlayers; … … 1208 1202 1209 1203 void CNetServerWorker::CheckGameLoadStatus(CNetServerSession* changedSession) 1210 1204 { 1211 for ( size_t i = 0; i < m_Sessions.size(); ++i)1205 for (const CNetServerSession* session : m_Sessions) 1212 1206 { 1213 if ( m_Sessions[i] != changedSession && m_Sessions[i]->GetCurrState() != NSS_INGAME)1207 if (session != changedSession && session->GetCurrState() != NSS_INGAME) 1214 1208 return; 1215 1209 } 1216 1210 … … 1225 1219 { 1226 1220 m_ServerTurnManager = new CNetServerTurnManager(*this); 1227 1221 1228 for ( size_t i = 0; i < m_Sessions.size(); ++i)1229 m_ServerTurnManager->InitialiseClient( m_Sessions[i]->GetHostID(), 0); // TODO: only for non-observers1222 for (const CNetServerSession* session : m_Sessions) 1223 m_ServerTurnManager->InitialiseClient(session->GetHostID(), 0); // TODO: only for non-observers 1230 1224 1231 1225 m_State = SERVER_STATE_LOADING; 1232 1226 … … 1289 1283 while (true) 1290 1284 { 1291 1285 bool unique = true; 1292 for ( size_t i = 0; i < m_Sessions.size(); ++i)1286 for (const CNetServerSession* session : m_Sessions) 1293 1287 { 1294 if ( m_Sessions[i]->GetUserName() == name)1288 if (session->GetUserName() == name) 1295 1289 { 1296 1290 unique = false; 1297 1291 break; -
source/network/NetServer.h
327 327 * turn number, to simplify support for rejoining etc. 328 328 * TODO: verify this doesn't use too much RAM. 329 329 */ 330 std::vector<std::vector<CSimulationMessage> 330 std::vector<std::vector<CSimulationMessage>> m_SavedCommands; 331 331 332 332 /** 333 333 * The latest copy of the simulation state, received from an existing … … 361 361 bool m_Shutdown; // protected by m_WorkerMutex 362 362 363 363 // Queues for messages sent by the game thread: 364 std::vector<std::pair<int, CStr> 364 std::vector<std::pair<int, CStr>> m_AssignPlayerQueue; // protected by m_WorkerMutex 365 365 std::vector<bool> m_StartGameQueue; // protected by m_WorkerMutex 366 std::vector<std::pair<CStr, int> 366 std::vector<std::pair<CStr, int>> m_PlayerReadyQueue; // protected by m_WorkerMutex 367 367 std::vector<bool> m_PlayerResetReadyQueue; // protected by m_WorkerMutex 368 368 std::vector<std::string> m_GameAttributesQueue; // protected by m_WorkerMutex 369 369 std::vector<u32> m_TurnLengthQueue; // protected by m_WorkerMutex -
source/network/NetStats.cpp
1 /* Copyright (C) 201 0Wildfire Games.1 /* Copyright (C) 2016 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 69 69 { 70 70 m_ColumnDescriptions.clear(); 71 71 m_ColumnDescriptions.push_back(ProfileColumn("Name", 200)); 72 72 73 if (m_Peer) 73 {74 74 m_ColumnDescriptions.push_back(ProfileColumn("Value", 80)); 75 }76 75 else 77 76 { 78 77 CScopeLock lock(m_Mutex); … … 80 79 for (size_t i = 0; i < m_LatchedData.size(); ++i) 81 80 m_ColumnDescriptions.push_back(ProfileColumn("Peer "+CStr::FromUInt(i), 80)); 82 81 } 82 83 83 return m_ColumnDescriptions; 84 84 } 85 85 -
source/network/NetStats.h
1 /* Copyright (C) 201 0Wildfire Games.1 /* Copyright (C) 2016 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 54 54 std::vector<ProfileColumn> m_ColumnDescriptions; 55 55 56 56 CMutex m_Mutex; 57 std::vector<std::vector<CStr> 57 std::vector<std::vector<CStr>> m_LatchedData; // protected by m_Mutex 58 58 }; 59 59 60 60 #endif // INCLUDED_NETSTATS -
source/network/NetTurnManager.cpp
170 170 171 171 // Put all the client commands into a single list, in a globally consistent order 172 172 std::vector<SimulationCommand> commands; 173 for (std::map<u32, std::vector<SimulationCommand> >::iterator it = m_QueuedCommands[0].begin(); it != m_QueuedCommands[0].end(); ++it) 174 { 175 commands.insert(commands.end(), std::make_move_iterator(it->second.begin()), std::make_move_iterator(it->second.end())); 176 } 173 for (std::pair<const u32, std::vector<SimulationCommand>>& p : m_QueuedCommands[0]) 174 commands.insert(commands.end(), std::make_move_iterator(p.second.begin()), std::make_move_iterator(p.second.end())); 175 177 176 m_QueuedCommands.pop_front(); 178 177 m_QueuedCommands.resize(m_QueuedCommands.size() + 1); 179 178 … … 214 213 215 214 // Put all the client commands into a single list, in a globally consistent order 216 215 std::vector<SimulationCommand> commands; 217 for (std::map<u32, std::vector<SimulationCommand> >::iterator it = m_QueuedCommands[0].begin(); it != m_QueuedCommands[0].end(); ++it) 218 { 219 commands.insert(commands.end(), std::make_move_iterator(it->second.begin()), std::make_move_iterator(it->second.end())); 220 } 216 for (std::pair<const u32, std::vector<SimulationCommand>>& p : m_QueuedCommands[0]) 217 commands.insert(commands.end(), std::make_move_iterator(p.second.begin()), std::make_move_iterator(p.second.end())); 218 221 219 m_QueuedCommands.pop_front(); 222 220 m_QueuedCommands.resize(m_QueuedCommands.size() + 1); 223 221 … … 564 562 m_TurnLength = m_ReplayTurnLengths[turn]; 565 563 566 564 // Simulate commands for that turn 567 for (const std::pair<player_id_t, std::string>& p air: m_ReplayCommands[turn])565 for (const std::pair<player_id_t, std::string>& p : m_ReplayCommands[turn]) 568 566 { 569 567 JS::RootedValue command(m_Simulation2.GetScriptInterface().GetContext()); 570 m_Simulation2.GetScriptInterface().ParseJSON(p air.second, &command);571 AddCommand(m_ClientId, p air.first, command, m_CurrentTurn + 1);568 m_Simulation2.GetScriptInterface().ParseJSON(p.second, &command); 569 AddCommand(m_ClientId, p.first, command, m_CurrentTurn + 1); 572 570 } 573 571 574 572 if (turn == m_FinalTurn) … … 602 600 void CNetServerTurnManager::CheckClientsReady() 603 601 { 604 602 // See if all clients (including self) are ready for a new turn 605 for ( std::map<int, u32>::iterator it = m_ClientsReady.begin(); it != m_ClientsReady.end(); ++it)603 for (const std::pair<int, u32>& clientReady : m_ClientsReady) 606 604 { 607 NETTURN_LOG((L" %d: %d <=? %d\n", it->first, it->second, m_ReadyTurn));608 if ( it->second <= m_ReadyTurn)605 NETTURN_LOG((L" %d: %d <=? %d\n", clientReady.first, clientReady.second, m_ReadyTurn)); 606 if (clientReady.second <= m_ReadyTurn) 609 607 return; // wasn't ready for m_ReadyTurn+1 610 608 } 611 609 … … 640 638 641 639 // Find the newest turn which we know all clients have simulated 642 640 u32 newest = std::numeric_limits<u32>::max(); 643 for (std::map<int, u32>::iterator it = m_ClientsSimulated.begin(); it != m_ClientsSimulated.end(); ++it) 644 { 645 if (it->second < newest) 646 newest = it->second; 647 } 641 for (const std::pair<int, u32>& clientSimulated : m_ClientsSimulated) 642 if (clientSimulated.second < newest) 643 newest = clientSimulated.second; 648 644 649 645 // For every set of state hashes that all clients have simulated, check for OOS 650 for ( std::map<u32, std::map<int, std::string> >::iterator it = m_ClientStateHashes.begin(); it != m_ClientStateHashes.end(); ++it)646 for (const std::pair<u32, std::map<int, std::string>>& clientStateHash : m_ClientStateHashes) 651 647 { 652 if ( it->first > newest)648 if (clientStateHash.first > newest) 653 649 break; 654 650 655 651 // Assume the host is correct (maybe we should choose the most common instead to help debugging) 656 std::string expected = it->second.begin()->second;652 std::string expected = clientStateHash.second.begin()->second; 657 653 658 654 // Find all players that are OOS on that turn 659 655 std::vector<CStrW> OOSPlayerNames; 660 for ( std::map<int, std::string>::iterator cit = it->second.begin(); cit != it->second.end(); ++cit)656 for (const std::pair<int, std::string>& hashPair : clientStateHash.second) 661 657 { 662 658 NETTURN_LOG((L"sync check %d: %d = %hs\n", it->first, cit->first, Hexify(cit->second).c_str())); 663 if ( cit->second != expected)659 if (hashPair.second != expected) 664 660 { 665 661 // Oh no, out of sync 666 662 m_HasSyncError = true; 667 OOSPlayerNames.push_back(m_ClientPlayernames[ cit->first]);663 OOSPlayerNames.push_back(m_ClientPlayernames[hashPair.first]); 668 664 } 669 665 } 670 666 … … 672 668 if (m_HasSyncError) 673 669 { 674 670 CSyncErrorMessage msg; 675 msg.m_Turn = it->first;671 msg.m_Turn = clientStateHash.first; 676 672 msg.m_HashExpected = expected; 677 673 for (const CStrW& playername : OOSPlayerNames) 678 674 { -
source/network/NetTurnManager.h
180 180 u32 m_TurnLength; 181 181 182 182 /// Commands queued at each turn (index 0 is for m_CurrentTurn+1) 183 std::deque<std::map<u32, std::vector<SimulationCommand> >> m_QueuedCommands;183 std::deque<std::map<u32, std::vector<SimulationCommand>>> m_QueuedCommands; 184 184 185 185 int m_PlayerId; 186 186 uint m_ClientId; … … 272 272 void DoTurn(u32 turn); 273 273 274 274 // Contains the commands of every player on each turn 275 std::map<u32, std::vector<std::pair<player_id_t, std::string> >> m_ReplayCommands;275 std::map<u32, std::vector<std::pair<player_id_t, std::string>>> m_ReplayCommands; 276 276 277 277 // Contains the length of every turn 278 278 std::map<u32, u32> m_ReplayTurnLengths; 279 279 280 280 // Contains all replay hash values and weather or not the quick hash method was used 281 std::map<u32, std::pair<std::string, bool> 281 std::map<u32, std::pair<std::string, bool>> m_ReplayHash; 282 282 }; 283 283 /** 284 284 * The server-side counterpart to CNetClientTurnManager. … … 337 337 std::map<int, u32> m_ClientsSimulated; 338 338 339 339 // Map of turn -> {Client ID -> state hash}; old indexes <= min(m_ClientsSimulated) are deleted 340 std::map<u32, std::map<int, std::string> 340 std::map<u32, std::map<int, std::string>> m_ClientStateHashes; 341 341 342 342 // Map of client ID -> playername 343 343 std::map<u32, CStrW> m_ClientPlayernames;