Changeset View
Standalone View
source/network/NetClient.cpp
Context not available. | |||||
JS::RootedValue msg(cx); | JS::RootedValue msg(cx); | ||||
GetScriptInterface().Eval("({'type':'netstatus','status':'waiting_for_players'})", &msg); | GetScriptInterface().Eval("({'type':'netstatus','status':'waiting_for_players'})", &msg); | ||||
PushGuiMessage(msg); | PushGuiMessage(msg); | ||||
// We allowed longer timeouts during loading, so now return them to normal. | |||||
m_Session->SetLongTimeout(false); | |||||
elexis: I was thinking that the reset call should be here, but the client didn't catch up yet with the… | |||||
} | } | ||||
CLoadedGameMessage loaded; | CLoadedGameMessage loaded; | ||||
Context not available. | |||||
JSContext* cx = client->GetScriptInterface().GetContext(); | JSContext* cx = client->GetScriptInterface().GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
// Prevent player drops during loading. | |||||
client->m_Session->SetLongTimeout(true); | |||||
// Find the player assigned to our GUID | // Find the player assigned to our GUID | ||||
int player = -1; | int player = -1; | ||||
if (client->m_PlayerAssignments.find(client->m_GUID) != client->m_PlayerAssignments.end()) | if (client->m_PlayerAssignments.find(client->m_GUID) != client->m_PlayerAssignments.end()) | ||||
Done Inline ActionsIf this were placed before StartGame, then it wouldn't assume StartGame to be quick elexis: If this were placed before StartGame, then it wouldn't assume StartGame to be quick | |||||
Context not available. | |||||
CNetClient* client = (CNetClient*)context; | CNetClient* client = (CNetClient*)context; | ||||
// Prevent player drops during loading. | |||||
client->m_Session->SetLongTimeout(true); | |||||
Not Done Inline ActionsThis function is called when the client starts the download of the simstate. elexis: This function is called when the client starts the download of the simstate.
After the download… | |||||
Done Inline Actionswhitespace is only allowed before the last non whitespace character elexis: whitespace is only allowed before the last non whitespace character | |||||
// The server wants us to start downloading the game state from it, so do so | // The server wants us to start downloading the game state from it, so do so | ||||
client->m_Session->GetFileTransferer().StartTask( | client->m_Session->GetFileTransferer().StartTask( | ||||
Done Inline ActionsSame (assumes the download call to not freeze) One could consider moving it to the constructor too. No opinion. elexis: Same (assumes the download call to not freeze)
One could consider moving it to the constructor… | |||||
shared_ptr<CNetFileReceiveTask>(new CNetFileReceiveTask_ClientRejoin(*client)) | shared_ptr<CNetFileReceiveTask>(new CNetFileReceiveTask_ClientRejoin(*client)) | ||||
Context not available. | |||||
// If we have rejoined an in progress game, send the rejoined message to the server. | // If we have rejoined an in progress game, send the rejoined message to the server. | ||||
if (client->m_Rejoin) | if (client->m_Rejoin) | ||||
{ | |||||
client->SendRejoinedMessage(); | client->SendRejoinedMessage(); | ||||
Done Inline ActionsThe call is needed for rejoined clients for sure. elexis: The call is needed for rejoined clients for sure.
But non-rejoined clients at the gamestart… | |||||
Not Done Inline ActionsLoadFinished is called when clients joined and at the start of the game, but occurs before rejoining clients have synchronized. Therefore I am unsetting the long timeout here for rejoining clients, and in LoadFinished for others. causative: LoadFinished is called when clients joined and at the start of the game, but occurs before… | |||||
Not Done Inline ActionsI was wrong, the last client to leave the loading screen doesn't receive the CClientsLoadingMessage, so we need to call this here for that one client too (and may do so redundantly for the others). elexis: I was wrong, the last client to leave the loading screen doesn't receive the… | |||||
// We allowed longer timeouts during loading, so now return them to normal. | |||||
client->m_Session->SetLongTimeout(false); | |||||
} | |||||
return true; | return true; | ||||
} | } | ||||
Context not available. |
I was thinking that the reset call should be here, but the client didn't catch up yet with the turns that were performed after the rejoin started.