Core/WorldSession: Fix idle WorldSessions getting kicked twice as fast as supposed

Port From (https://github.com/TrinityCore/TrinityCore/commit/f1388f37b6151252aae7431921564cf2458226a4)
This commit is contained in:
hondacrx
2021-03-04 11:40:50 -05:00
parent 4fcdbbe891
commit 102034a891
2 changed files with 9 additions and 15 deletions
+3 -2
View File
@@ -289,8 +289,9 @@ namespace Game
Values[WorldCfg.PortInstance] = GetDefaultValue("InstanceServerPort", 8086);
}
Values[WorldCfg.SocketTimeoutTime] = GetDefaultValue("SocketTimeOutTime", 900000);
Values[WorldCfg.SocketTimeoutTimeActive] = GetDefaultValue("SocketTimeOutTimeActive", 60000);
// Config values are in "milliseconds" but we handle SocketTimeOut only as "seconds" so divide by 1000
Values[WorldCfg.SocketTimeoutTime] = GetDefaultValue("SocketTimeOutTime", 900000) / 1000;
Values[WorldCfg.SocketTimeoutTimeActive] = GetDefaultValue("SocketTimeOutTimeActive", 60000) / 1000;
Values[WorldCfg.SessionAddDelay] = GetDefaultValue("SessionAddDelay", 10000);
Values[WorldCfg.GroupXpDistance] = GetDefaultValue("MaxGroupXPDistance", 74.0f);
+6 -13
View File
@@ -241,9 +241,6 @@ namespace Game
public bool Update(uint diff, PacketFilter updater)
{
// Update Timeout timer.
UpdateTimeOutTime(diff);
// Before we process anything:
/// If necessary, kick the player because the client didn't send anything for too long
/// (or they've been idling in character select)
@@ -820,21 +817,17 @@ namespace Game
public uint GetLatency() { return m_latency; }
public void SetLatency(uint latency) { m_latency = latency; }
public void ResetClientTimeDelay() { m_clientTimeDelay = 0; }
void UpdateTimeOutTime(uint diff)
{
if (diff > m_timeOutTime)
m_timeOutTime = 0;
else
m_timeOutTime -= diff;
}
public void ResetTimeOutTime(bool onlyActive)
{
if (GetPlayer())
m_timeOutTime = WorldConfig.GetIntValue(WorldCfg.SocketTimeoutTimeActive);
m_timeOutTime = GameTime.GetGameTime() + WorldConfig.GetIntValue(WorldCfg.SocketTimeoutTimeActive);
else if (!onlyActive)
m_timeOutTime = WorldConfig.GetIntValue(WorldCfg.SocketTimeoutTime);
m_timeOutTime = GameTime.GetGameTime() + WorldConfig.GetIntValue(WorldCfg.SocketTimeoutTime);
}
bool IsConnectionIdle()
{
return m_timeOutTime < GameTime.GetGameTime() && !m_inQueue;
}
bool IsConnectionIdle() { return (m_timeOutTime <= 0 && !m_inQueue); }
public uint GetRecruiterId() { return recruiterId; }
public bool IsARecruiter() { return isRecruiter; }