From 7e10e6ba811e7170dd797b4f0fab60877902a56d Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sun, 6 Dec 2015 19:38:09 +0100 Subject: [PATCH] Push 2FA requests ahead of queue --- ArchiSteamFarm/Bot.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 8543390ab..77e3ab545 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -233,7 +233,12 @@ namespace ArchiSteamFarm { IsRunning = true; Logging.LogGenericInfo(BotName, "Starting..."); - await Program.LimitSteamRequestsAsync().ConfigureAwait(false); + + // 2FA tokens are expiring soon, use limiter only when we don't have any pending + if (TwoFactorAuth == null) { + await Program.LimitSteamRequestsAsync().ConfigureAwait(false); + } + SteamClient.Connect(); var fireAndForget = Task.Run(() => HandleCallbacks()); @@ -398,7 +403,12 @@ namespace ArchiSteamFarm { } Logging.LogGenericWarning(BotName, "Disconnected from Steam, reconnecting..."); - await Program.LimitSteamRequestsAsync().ConfigureAwait(false); + + // 2FA tokens are expiring soon, use limiter only when we don't have any pending + if (TwoFactorAuth == null) { + await Program.LimitSteamRequestsAsync().ConfigureAwait(false); + } + SteamClient.Connect(); } @@ -533,6 +543,10 @@ namespace ArchiSteamFarm { case EResult.OK: Logging.LogGenericInfo(BotName, "Successfully logged on!"); + // Reset one-time-only access tokens + AuthCode = null; + TwoFactorAuth = null; + if (!SteamNickname.Equals("null")) { SteamFriends.SetPersonaName(SteamNickname); }