From 06e2e77349096b8a8761ebc69b48f1c6b347c012 Mon Sep 17 00:00:00 2001 From: elexis Date: Fri, 1 Jun 2018 17:35:00 +0000 Subject: [PATCH] Report network timeouts and lag warnings to clients that finished the loading screen but are waiting for other clients to finish it. This allows the host to distinguish clients that are just slower than everyone else with the loading screen from clients who have most likely disconnected or crashed already and may be considered to be kicked. This is especially important for D1513, because that increases the timeout tolerance to a minute or longer. Fixes #5193 Differential Revision: https://code.wildfiregames.com/D1546 Reviewed By: causative This was SVN commit r21832. --- source/network/NetClient.cpp | 6 ------ source/network/NetServer.cpp | 9 ++++----- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/source/network/NetClient.cpp b/source/network/NetClient.cpp index bc197f0c16..eb7802a371 100644 --- a/source/network/NetClient.cpp +++ b/source/network/NetClient.cpp @@ -775,9 +775,6 @@ bool CNetClient::OnClientTimeout(void *context, CFsmEvent* event) JSContext* cx = client->GetScriptInterface().GetContext(); JSAutoRequest rq(cx); - if (client->GetCurrState() == NCS_LOADING) - return true; - CClientTimeoutMessage* message = (CClientTimeoutMessage*)event->GetParamRef(); JS::RootedValue msg(cx); @@ -799,9 +796,6 @@ bool CNetClient::OnClientPerformance(void *context, CFsmEvent* event) JSContext* cx = client->GetScriptInterface().GetContext(); JSAutoRequest rq(cx); - if (client->GetCurrState() == NCS_LOADING) - return true; - CClientPerformanceMessage* message = (CClientPerformanceMessage*)event->GetParamRef(); // Display warnings for other clients with bad ping diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp index cdcc7c137a..eaadbb7271 100644 --- a/source/network/NetServer.cpp +++ b/source/network/NetServer.cpp @@ -553,9 +553,6 @@ bool CNetServerWorker::RunStep() void CNetServerWorker::CheckClientConnections() { - if (m_State == SERVER_STATE_LOADING) - return; - // Send messages at most once per second std::time_t now = std::time(nullptr); if (now <= m_LastConnectionCheck) @@ -590,12 +587,14 @@ void CNetServerWorker::CheckClientConnections() } // Send to all clients except the affected one - // (since that will show the locally triggered warning instead) + // (since that will show the locally triggered warning instead). + // Also send it to clients that finished the loading screen while + // the game is still waiting for other clients to finish the loading screen. if (message) for (size_t j = 0; j < m_Sessions.size(); ++j) { if (i != j && ( - m_Sessions[j]->GetCurrState() == NSS_PREGAME || + (m_Sessions[j]->GetCurrState() == NSS_PREGAME && m_State == SERVER_STATE_PREGAME) || m_Sessions[j]->GetCurrState() == NSS_INGAME)) { m_Sessions[j]->SendMessage(message);