From 1a1914540cda2a4dc6c929f80e980449284ab823 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Mon, 20 Jun 2016 20:29:12 +0200 Subject: [PATCH] Fix !2faok with many confirmations --- ArchiSteamFarm/Bot.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index b8a36869d..a6ad38e25 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -261,8 +261,8 @@ namespace ArchiSteamFarm { } if ((acceptedSteamID != 0) || ((acceptedTradeIDs != null) && (acceptedTradeIDs.Count > 0))) { - List> detailsTasks = confirmations.Select(BotDatabase.MobileAuthenticator.GetConfirmationDetails).ToList(); - Steam.ConfirmationDetails[] detailsResults = await Task.WhenAll(detailsTasks).ConfigureAwait(false); + List> tasks = confirmations.Select(BotDatabase.MobileAuthenticator.GetConfirmationDetails).ToList(); + Steam.ConfirmationDetails[] detailsResults = await Task.WhenAll(tasks).ConfigureAwait(false); HashSet ignoredConfirmationIDs = new HashSet(); foreach (Steam.ConfirmationDetails details in detailsResults.Where(details => (details != null) && ( @@ -282,8 +282,11 @@ namespace ArchiSteamFarm { } } - List> tasks = confirmations.Select(confirmation => BotDatabase.MobileAuthenticator.HandleConfirmation(confirmation, accept)).ToList(); - await Task.WhenAll(tasks).ConfigureAwait(false); + // This could be done in parallel, but for some reason Steam allows only one confirmation being accepted at the time + // Therefore, even though no physical barrier stops us from doing so, we execute this synchronously + foreach (MobileAuthenticator.Confirmation confirmation in confirmations) { + await BotDatabase.MobileAuthenticator.HandleConfirmation(confirmation, accept).ConfigureAwait(false); + } } internal async Task RefreshSession() {