From 4a90470ccd9a9816a8bd499f8af4c26e7bf5f0b0 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 24 Feb 2018 23:40:28 +0100 Subject: [PATCH] Add workaround for rare Steam fuckup Under rare Steam maintenance it's possible that we can get one rare logon session replaced for no apparent reason. --- ArchiSteamFarm/Bot.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 69ed15e86..d59547f69 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -135,6 +135,7 @@ namespace ArchiSteamFarm { private byte HeartBeatFailures; private uint ItemsCount; private EResult LastLogOnResult; + private DateTime LastLogonSessionReplaced = DateTime.MinValue; private ulong LibraryLockedBySteamID; private bool LootingAllowed = true; private bool LootingScheduled; @@ -1972,9 +1973,16 @@ namespace ArchiSteamFarm { switch (callback.Result) { case EResult.LogonSessionReplaced: - ArchiLogger.LogGenericError(Strings.BotLogonSessionReplaced); - Stop(); - return; + DateTime now = DateTime.UtcNow; + + if (now.Subtract(LastLogonSessionReplaced).TotalHours < 1) { + ArchiLogger.LogGenericError(Strings.BotLogonSessionReplaced); + Stop(); + return; + } + + LastLogonSessionReplaced = now; + break; } ReconnectOnUserInitiated = true;