Fix network FSM errors when a client closes the game during the loading screen or rejoin synchronization stage, fixes #4594, refs 3199.
Fix comments claiming to ensure reliability when in reality there is only a small likelihood of the message being received. Broken byfa85527baf
/ refs #2420 which was a preparation fora3e1c68b9a
/ refs #2373, which hence didn't actually work and was circumvented by9b136a45fc
without clarification. Might have caused #3643. Differential Revision: https://code.wildfiregames.com/D1557 Reviewed By: Imarok This was SVN commit r21837.
This commit is contained in:
parent
ee9cf54149
commit
43730f15f3
@ -181,11 +181,11 @@ void CNetClient::SetAndOwnSession(CNetClientSession* session)
|
||||
|
||||
void CNetClient::DestroyConnection()
|
||||
{
|
||||
// Send network messages from the current frame before connection is destroyed.
|
||||
// Attempt to send network messages from the current frame before connection is destroyed.
|
||||
if (m_ClientTurnManager)
|
||||
{
|
||||
m_ClientTurnManager->OnDestroyConnection(); // End sending of commands for scheduled turn.
|
||||
Flush(); // Make sure the messages are sent.
|
||||
m_ClientTurnManager->OnDestroyConnection();
|
||||
Flush();
|
||||
}
|
||||
SAFE_DELETE(m_Session);
|
||||
}
|
||||
|
@ -95,7 +95,10 @@ void CNetClientTurnManager::NotifyFinishedUpdate(u32 turn)
|
||||
|
||||
void CNetClientTurnManager::OnDestroyConnection()
|
||||
{
|
||||
NotifyFinishedOwnCommands(m_CurrentTurn + COMMAND_DELAY);
|
||||
// Attempt to flush messages before leaving.
|
||||
// Notice the sending is not reliable and rarely makes it to the Server.
|
||||
if (m_NetClient.GetCurrState() == NCS_INGAME)
|
||||
NotifyFinishedOwnCommands(m_CurrentTurn + COMMAND_DELAY);
|
||||
}
|
||||
|
||||
void CNetClientTurnManager::OnSimulationMessage(CSimulationMessage* msg)
|
||||
|
Loading…
Reference in New Issue
Block a user