aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/WorldSession.cpp14
-rw-r--r--src/server/game/Server/WorldSession.h2
-rw-r--r--src/server/game/Server/WorldSocket.cpp8
3 files changed, 15 insertions, 9 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index ef257e71c9f..0e3817bb509 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -142,7 +142,7 @@ WorldSession::WorldSession(uint32 id, std::string&& name, uint32 battlenetAccoun
if (sock)
{
m_Address = sock->GetRemoteIpAddress().to_string();
- ResetTimeOutTime();
+ ResetTimeOutTime(false);
LoginDatabase.PExecute("UPDATE account SET online = 1 WHERE id = %u;", GetAccountId()); // One-time query
}
@@ -327,7 +327,8 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
UpdateTimeOutTime(diff);
///- 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())
m_Socket[CONNECTION_TYPE_REALM]->CloseSocket();
@@ -697,9 +698,12 @@ char const* WorldSession::GetTrinityString(uint32 entry) const
return sObjectMgr->GetTrinityString(entry, GetSessionDbLocaleIndex());
}
-void WorldSession::ResetTimeOutTime()
+void WorldSession::ResetTimeOutTime(bool onlyActive)
{
- m_timeOutTime = int32(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME));
+ if (GetPlayer())
+ m_timeOutTime = int32(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME_ACTIVE));
+ else if (!onlyActive)
+ m_timeOutTime = int32(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME));
}
void WorldSession::Handle_NULL(WorldPackets::Null& null)
@@ -1069,7 +1073,7 @@ void WorldSession::InitializeSessionCallback(LoginDatabaseQueryHolder* realmHold
SendAuthWaitQue(0);
SetInQueue(false);
- ResetTimeOutTime();
+ ResetTimeOutTime(false);
SendSetTimeZoneInformation();
SendFeatureSystemStatusGlueScreen();
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 0f2a577d260..fdbac1a465e 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -1095,7 +1095,7 @@ class TC_GAME_API WorldSession
m_timeOutTime -= int32(diff);
}
- void ResetTimeOutTime();
+ void ResetTimeOutTime(bool onlyActive);
bool IsConnectionIdle() const
{
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp
index 022e1c289a2..0ea17e4143d 100644
--- a/src/server/game/Server/WorldSocket.cpp
+++ b/src/server/game/Server/WorldSocket.cpp
@@ -424,7 +424,10 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
return ReadDataHandlerResult::WaitingForQuery;
}
case CMSG_KEEP_ALIVE:
+ sessionGuard.lock();
LogOpcodeText(opcode, sessionGuard);
+ if (_worldSession)
+ _worldSession->ResetTimeOutTime(true);
break;
case CMSG_LOG_DISCONNECT:
LogOpcodeText(opcode, sessionGuard);
@@ -471,9 +474,8 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
break;
}
- // Our Idle timer will reset on any non PING opcodes.
- // Catches people idling on the login screen and any lingering ingame connections.
- _worldSession->ResetTimeOutTime();
+ // Our Idle timer will reset on any non PING opcodes on login screen, allowing us to catch people idling.
+ _worldSession->ResetTimeOutTime(false);
// Copy the packet to the heap before enqueuing
_worldSession->QueuePacket(new WorldPacket(std::move(packet)));