Prevent the local client of the host from becoming disconnected in case of lag, fixes #2854.

This was SVN commit r17772.
This commit is contained in:
elexis
2016-02-18 13:10:59 +00:00
parent f8b20d181d
commit 2e7e1c0b2b
3 changed files with 27 additions and 2 deletions
+5 -2
View File
@@ -486,6 +486,10 @@ bool CNetServerWorker::RunStep()
CNetServerSession* session = new CNetServerSession(*this, event.peer);
// Prevent the local client of the host from timing out too quickly
if (session->GetIPAddress() == "127.0.0.1")
enet_peer_timeout(event.peer, 0, MAXIMUM_HOST_TIMEOUT, MAXIMUM_HOST_TIMEOUT);
m_Sessions.push_back(session);
SetupSession(session);
@@ -679,8 +683,7 @@ void CNetServerWorker::OnUserJoin(CNetServerSession* session)
{
AddPlayer(session->GetGUID(), session->GetUserName());
// Host is the first to join
if (m_HostGUID.empty())
if (m_HostGUID.empty() && session->GetIPAddress() == "127.0.0.1")
m_HostGUID = session->GetGUID();
CGameSetupMessage gameSetupMessage(GetScriptInterface());