aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Server/WorldSession.cpp12
-rw-r--r--src/server/game/Server/WorldSession.h12
-rw-r--r--src/server/game/World/World.cpp6
3 files changed, 13 insertions, 17 deletions
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 6ac4bca9ca3..2a4771f4015 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -323,9 +323,6 @@ void WorldSession::LogUnprocessedTail(WorldPacket const* packet)
/// Update the WorldSession (triggered by World update)
bool WorldSession::Update(uint32 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)
@@ -702,9 +699,14 @@ char const* WorldSession::GetTrinityString(uint32 entry) const
void WorldSession::ResetTimeOutTime(bool onlyActive)
{
if (GetPlayer())
- m_timeOutTime = int32(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME_ACTIVE));
+ m_timeOutTime = GameTime::GetGameTime() + time_t(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME_ACTIVE));
else if (!onlyActive)
- m_timeOutTime = int32(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME));
+ m_timeOutTime = GameTime::GetGameTime() + time_t(sWorld->getIntConfig(CONFIG_SOCKET_TIMEOUTTIME));
+}
+
+bool WorldSession::IsConnectionIdle() const
+{
+ return m_timeOutTime < GameTime::GetGameTime() && !m_inQueue;
}
void WorldSession::Handle_NULL(WorldPackets::Null& null)
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 423d83d582e..c8fcd89ac75 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -1096,19 +1096,11 @@ class TC_GAME_API WorldSession
void SetLatency(uint32 latency) { m_latency = latency; }
void ResetClientTimeDelay() { m_clientTimeDelay = 0; }
- std::atomic<int32> m_timeOutTime;
-
- void UpdateTimeOutTime(uint32 diff)
- {
- m_timeOutTime -= int32(diff);
- }
+ std::atomic<time_t> m_timeOutTime;
void ResetTimeOutTime(bool onlyActive);
- bool IsConnectionIdle() const
- {
- return m_timeOutTime <= 0 && !m_inQueue;
- }
+ bool IsConnectionIdle() const;
// Recruit-A-Friend Handling
uint32 GetRecruiterId() const { return recruiterId; }
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 5a58d2c3a4d..4dada5a5091 100644
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -810,8 +810,10 @@ void World::LoadConfigSettings(bool reload)
m_int_configs[CONFIG_PORT_INSTANCE] = sConfigMgr->GetIntDefault("InstanceServerPort", 8086);
}
- m_int_configs[CONFIG_SOCKET_TIMEOUTTIME] = sConfigMgr->GetIntDefault("SocketTimeOutTime", 900000);
- m_int_configs[CONFIG_SOCKET_TIMEOUTTIME_ACTIVE] = sConfigMgr->GetIntDefault("SocketTimeOutTimeActive", 60000);
+ // Config values are in "milliseconds" but we handle SocketTimeOut only as "seconds" so divide by 1000
+ m_int_configs[CONFIG_SOCKET_TIMEOUTTIME] = sConfigMgr->GetIntDefault("SocketTimeOutTime", 900000) / 1000;
+ m_int_configs[CONFIG_SOCKET_TIMEOUTTIME_ACTIVE] = sConfigMgr->GetIntDefault("SocketTimeOutTimeActive", 60000) / 1000;
+
m_int_configs[CONFIG_SESSION_ADD_DELAY] = sConfigMgr->GetIntDefault("SessionAddDelay", 10000);
m_float_configs[CONFIG_GROUP_XP_DISTANCE] = sConfigMgr->GetFloatDefault("MaxGroupXPDistance", 74.0f);