From 4f0552a8df38d5450c77c8ed3f70f23fda000e97 Mon Sep 17 00:00:00 2001 From: furo Date: Wed, 27 Sep 2023 12:12:12 +0200 Subject: [PATCH] Expire server info when changing m_Afk --- src/game/server/player.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index cccc67ac6..5a6b6effd 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -219,7 +219,7 @@ void CPlayer::Tick() if(Server()->GetNetErrorString(m_ClientID)[0]) { - m_Afk = true; + SetAfk(true); char aBuf[512]; str_format(aBuf, sizeof(aBuf), "'%s' would have timed out, but can use timeout protection now", Server()->ClientName(m_ClientID)); @@ -705,11 +705,14 @@ void CPlayer::UpdatePlaytime() void CPlayer::AfkTimer() { - m_Afk = g_Config.m_SvMaxAfkTime != 0 && m_LastPlaytime < time_get() - time_freq() * g_Config.m_SvMaxAfkTime; + SetAfk(g_Config.m_SvMaxAfkTime != 0 && m_LastPlaytime < time_get() - time_freq() * g_Config.m_SvMaxAfkTime); } void CPlayer::SetAfk(bool Afk) { + if(m_Afk != Afk) + Server()->ExpireServerInfo(); + if(g_Config.m_SvMaxAfkTime == 0) { m_Afk = false;