Proper client timeout detection
Port From (https://github.com/TrinityCore/TrinityCore/commit/2c3fc47a96baa8a47130befda647bf29d8eacce1)
This commit is contained in:
@@ -1335,7 +1335,8 @@ namespace Framework.Constants
|
|||||||
SkillMilling,
|
SkillMilling,
|
||||||
SkillProspecting,
|
SkillProspecting,
|
||||||
SkipCinematics,
|
SkipCinematics,
|
||||||
SocketTimeouttime,
|
SocketTimeoutTime,
|
||||||
|
SocketTimeoutTimeActive,
|
||||||
StartAllExplored,
|
StartAllExplored,
|
||||||
StartAllRep,
|
StartAllRep,
|
||||||
StartAllSpells,
|
StartAllSpells,
|
||||||
|
|||||||
@@ -237,6 +237,10 @@ namespace Game.Networking
|
|||||||
authContinuedSession.Read();
|
authContinuedSession.Read();
|
||||||
HandleAuthContinuedSession(authContinuedSession);
|
HandleAuthContinuedSession(authContinuedSession);
|
||||||
break;
|
break;
|
||||||
|
case ClientOpcodes.KeepAlive:
|
||||||
|
if (_worldSession != null)
|
||||||
|
_worldSession.ResetTimeOutTime(true);
|
||||||
|
break;
|
||||||
case ClientOpcodes.LogDisconnect:
|
case ClientOpcodes.LogDisconnect:
|
||||||
break;
|
break;
|
||||||
case ClientOpcodes.EnableNagle:
|
case ClientOpcodes.EnableNagle:
|
||||||
@@ -264,9 +268,8 @@ namespace Game.Networking
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Our Idle timer will reset on any non PING opcodes.
|
// Our Idle timer will reset on any non PING opcodes on login screen, allowing us to catch people idling.
|
||||||
// Catches people idling on the login screen and any lingering ingame connections.
|
_worldSession.ResetTimeOutTime(false);
|
||||||
_worldSession.ResetTimeOutTime();
|
|
||||||
_worldSession.QueuePacket(packet);
|
_worldSession.QueuePacket(packet);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -289,7 +289,8 @@ namespace Game
|
|||||||
Values[WorldCfg.PortInstance] = GetDefaultValue("InstanceServerPort", 8086);
|
Values[WorldCfg.PortInstance] = GetDefaultValue("InstanceServerPort", 8086);
|
||||||
}
|
}
|
||||||
|
|
||||||
Values[WorldCfg.SocketTimeouttime] = GetDefaultValue("SocketTimeOutTime", 900000);
|
Values[WorldCfg.SocketTimeoutTime] = GetDefaultValue("SocketTimeOutTime", 900000);
|
||||||
|
Values[WorldCfg.SocketTimeoutTimeActive] = GetDefaultValue("SocketTimeOutTimeActive", 60000);
|
||||||
Values[WorldCfg.SessionAddDelay] = GetDefaultValue("SessionAddDelay", 10000);
|
Values[WorldCfg.SessionAddDelay] = GetDefaultValue("SessionAddDelay", 10000);
|
||||||
|
|
||||||
Values[WorldCfg.GroupXpDistance] = GetDefaultValue("MaxGroupXPDistance", 74.0f);
|
Values[WorldCfg.GroupXpDistance] = GetDefaultValue("MaxGroupXPDistance", 74.0f);
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ namespace Game
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
sess.SetInQueue(false);
|
sess.SetInQueue(false);
|
||||||
sess.ResetTimeOutTime();
|
sess.ResetTimeOutTime(false);
|
||||||
m_QueuedPlayer.Remove(iter);
|
m_QueuedPlayer.Remove(iter);
|
||||||
found = true; // removing queued session
|
found = true; // removing queued session
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Game
|
|||||||
_collectionMgr = new CollectionMgr(this);
|
_collectionMgr = new CollectionMgr(this);
|
||||||
|
|
||||||
m_Address = sock.GetRemoteIpAddress().ToString();
|
m_Address = sock.GetRemoteIpAddress().ToString();
|
||||||
ResetTimeOutTime();
|
ResetTimeOutTime(false);
|
||||||
DB.Login.Execute("UPDATE account SET online = 1 WHERE id = {0};", GetAccountId()); // One-time query
|
DB.Login.Execute("UPDATE account SET online = 1 WHERE id = {0};", GetAccountId()); // One-time query
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +240,8 @@ namespace Game
|
|||||||
UpdateTimeOutTime(diff);
|
UpdateTimeOutTime(diff);
|
||||||
|
|
||||||
// Before we process anything:
|
// Before we process anything:
|
||||||
// If necessary, kick the player from the character select screen
|
/// If necessary, kick the player because the client didn't send anything for too long
|
||||||
|
/// (or they've been idling in character select)
|
||||||
if (IsConnectionIdle())
|
if (IsConnectionIdle())
|
||||||
m_Socket[(int)ConnectionType.Realm].CloseSocket();
|
m_Socket[(int)ConnectionType.Realm].CloseSocket();
|
||||||
|
|
||||||
@@ -737,7 +738,7 @@ namespace Game
|
|||||||
SendAuthWaitQue(0);
|
SendAuthWaitQue(0);
|
||||||
|
|
||||||
SetInQueue(false);
|
SetInQueue(false);
|
||||||
ResetTimeOutTime();
|
ResetTimeOutTime(false);
|
||||||
|
|
||||||
SendSetTimeZoneInformation();
|
SendSetTimeZoneInformation();
|
||||||
SendFeatureSystemStatusGlueScreen();
|
SendFeatureSystemStatusGlueScreen();
|
||||||
@@ -815,7 +816,13 @@ namespace Game
|
|||||||
else
|
else
|
||||||
m_timeOutTime -= diff;
|
m_timeOutTime -= diff;
|
||||||
}
|
}
|
||||||
public void ResetTimeOutTime() { m_timeOutTime = WorldConfig.GetIntValue(WorldCfg.SocketTimeouttime); }
|
public void ResetTimeOutTime(bool onlyActive)
|
||||||
|
{
|
||||||
|
if (GetPlayer())
|
||||||
|
m_timeOutTime = WorldConfig.GetIntValue(WorldCfg.SocketTimeoutTimeActive);
|
||||||
|
else if (!onlyActive)
|
||||||
|
m_timeOutTime = WorldConfig.GetIntValue(WorldCfg.SocketTimeoutTime);
|
||||||
|
}
|
||||||
bool IsConnectionIdle() { return (m_timeOutTime <= 0 && !m_inQueue); }
|
bool IsConnectionIdle() { return (m_timeOutTime <= 0 && !m_inQueue); }
|
||||||
|
|
||||||
public uint GetRecruiterId() { return recruiterId; }
|
public uint GetRecruiterId() { return recruiterId; }
|
||||||
|
|||||||
@@ -315,6 +315,15 @@ InstanceMapLoadAllGrids = 0
|
|||||||
|
|
||||||
SocketTimeOutTime = 900000
|
SocketTimeOutTime = 900000
|
||||||
|
|
||||||
|
#
|
||||||
|
# SocketTimeOutTimeActive
|
||||||
|
# Description: Time (in milliseconds) after which an idle connection is dropped while
|
||||||
|
# logged into the world.
|
||||||
|
# The client sends keepalive packets every 30 seconds. Values <= 30s are not recommended.
|
||||||
|
# Default: 60000 - (1 minute)
|
||||||
|
|
||||||
|
SocketTimeOutTimeActive = 60000
|
||||||
|
|
||||||
#
|
#
|
||||||
# SessionAddDelay
|
# SessionAddDelay
|
||||||
# Description: Time (in microseconds) that a network thread will sleep after authentication
|
# Description: Time (in microseconds) that a network thread will sleep after authentication
|
||||||
|
|||||||
Reference in New Issue
Block a user