mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/WorldSession: Fix idle WorldSessions getting kicked twice as fast as supposed
Fix SocketTimeOutTime and SocketTimeOutTimeActive settings being effectively halved by reducing the timeout time twice every update instead of just once, causing much faster kicks (i.e. after 30 seconds with 60 seconds set in the configs).
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include "Common.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "GameTime.h"
|
||||
#include "Group.h"
|
||||
#include "Guild.h"
|
||||
#include "GuildMgr.h"
|
||||
@@ -267,9 +268,6 @@ void WorldSession::LogUnprocessedTail(WorldPacket* 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)
|
||||
@@ -637,9 +635,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(WorldPacket& null)
|
||||
|
||||
@@ -432,19 +432,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; }
|
||||
|
||||
@@ -721,8 +721,10 @@ void World::LoadConfigSettings(bool reload)
|
||||
else
|
||||
m_int_configs[CONFIG_PORT_WORLD] = sConfigMgr->GetIntDefault("WorldServerPort", 8085);
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user