Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/network/NetServer.cpp
Show First 20 Lines • Show All 547 Lines • ▼ Show 20 Lines | case ENET_EVENT_TYPE_NONE: | ||||
break; | break; | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
void CNetServerWorker::CheckClientConnections() | void CNetServerWorker::CheckClientConnections() | ||||
{ | { | ||||
if (m_State == SERVER_STATE_LOADING) | |||||
return; | |||||
// Send messages at most once per second | // Send messages at most once per second | ||||
std::time_t now = std::time(nullptr); | std::time_t now = std::time(nullptr); | ||||
if (now <= m_LastConnectionCheck) | if (now <= m_LastConnectionCheck) | ||||
return; | return; | ||||
m_LastConnectionCheck = now; | m_LastConnectionCheck = now; | ||||
for (size_t i = 0; i < m_Sessions.size(); ++i) | for (size_t i = 0; i < m_Sessions.size(); ++i) | ||||
Show All 18 Lines | else if (meanRTT > DEFAULT_TURN_LENGTH_MP) | ||||
CClientPerformanceMessage::S_m_Clients client; | CClientPerformanceMessage::S_m_Clients client; | ||||
client.m_GUID = m_Sessions[i]->GetGUID(); | client.m_GUID = m_Sessions[i]->GetGUID(); | ||||
client.m_MeanRTT = meanRTT; | client.m_MeanRTT = meanRTT; | ||||
msg->m_Clients.push_back(client); | msg->m_Clients.push_back(client); | ||||
message = msg; | message = msg; | ||||
} | } | ||||
// Send to all clients except the affected one | // 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) | if (message) | ||||
for (size_t j = 0; j < m_Sessions.size(); ++j) | for (size_t j = 0; j < m_Sessions.size(); ++j) | ||||
{ | { | ||||
if (i != 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]->GetCurrState() == NSS_INGAME)) | ||||
{ | { | ||||
m_Sessions[j]->SendMessage(message); | m_Sessions[j]->SendMessage(message); | ||||
} | } | ||||
} | } | ||||
SAFE_DELETE(message); | SAFE_DELETE(message); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 977 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator