Core/Session: proper client timeout detection (#1232)

* Core/Session: proper client timeout detection

- Properly detect client timeout when logged into a character after a configurable time (default 60s) has passed without the client sending any packets.
- Fixes issues with crashed clients leaving characters in the world for a very long time (default 15 minutes), as well as edge case exploits involving intentionally pausing client execution for some amount of time.
This commit is contained in:
Viste(Кирилл)
2019-01-08 09:33:24 +03:00
committed by GitHub
parent 09fa4c515b
commit f852a87f9c
6 changed files with 27 additions and 8 deletions

View File

@@ -681,8 +681,10 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
return -1;
}
return HandleAuthSession (*new_pct);
case CMSG_KEEP_ALIVE:
return 0;
case CMSG_KEEP_ALIVE:
if (m_Session)
m_Session->ResetTimeOutTime(true);
break;
default:
{
ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1);
@@ -691,7 +693,7 @@ int WorldSocket::ProcessIncoming(WorldPacket* new_pct)
{
// Our Idle timer will reset on any non PING opcodes.
// Catches people idling on the login screen and any lingering ingame connections.
m_Session->ResetTimeOutTime();
m_Session->ResetTimeOutTime(false);
// OK, give the packet to WorldSession
aptr.release();