Keep reconnecting if logging in to ISteamUserAuth fails

This commit is contained in:
JustArchi
2015-12-25 17:49:00 +01:00
parent 6cf264dcf7
commit 3bcecc6256
2 changed files with 9 additions and 7 deletions

View File

@@ -97,9 +97,9 @@ namespace ArchiSteamFarm {
}
}
internal async Task Init(SteamClient steamClient, string webAPIUserNonce, string vanityURL, string parentalPin) {
internal async Task<bool> Init(SteamClient steamClient, string webAPIUserNonce, string vanityURL, string parentalPin) {
if (steamClient == null || steamClient.SteamID == null || string.IsNullOrEmpty(webAPIUserNonce)) {
return;
return false;
}
SteamID = steamClient.SteamID;
@@ -139,14 +139,12 @@ namespace ArchiSteamFarm {
);
} catch (Exception e) {
Logging.LogGenericException(Bot.BotName, e);
steamClient.Disconnect(); // We may get 403 if we use the same webAPIUserNonce twice
return;
return false;
}
}
if (authResult == null) {
steamClient.Disconnect(); // Try again
return;
return false;
}
Logging.LogGenericInfo(Bot.BotName, "Success!");
@@ -161,6 +159,7 @@ namespace ArchiSteamFarm {
SteamCookieDictionary.Add("birthtime", "-473356799"); // ( ͡° ͜ʖ ͡°)
await UnlockParentalAccount(parentalPin).ConfigureAwait(false);
return true;
}
internal async Task<bool?> IsLoggedIn() {

View File

@@ -849,7 +849,10 @@ namespace ArchiSteamFarm {
SteamParentalPIN = Program.GetUserInput(BotName, Program.EUserInputType.SteamParentalPIN);
}
await ArchiWebHandler.Init(SteamClient, callback.WebAPIUserNonce, callback.VanityURL, SteamParentalPIN).ConfigureAwait(false);
if (!await ArchiWebHandler.Init(SteamClient, callback.WebAPIUserNonce, callback.VanityURL, SteamParentalPIN).ConfigureAwait(false)) {
await Restart().ConfigureAwait(false);
return;
}
if (SteamMasterClanID != 0) {
await ArchiWebHandler.JoinClan(SteamMasterClanID).ConfigureAwait(false);