We can actually move asking for token into OnConnected() method, nicely putting it into login limiter instead of being executed on every connection attempt. This way we'll avoid executing this function on obvius network issues.
This commit is contained in:
JustArchi
2017-07-21 01:24:59 +02:00
parent 93bc8373f8
commit be349d0557

View File

@@ -826,11 +826,6 @@ namespace ArchiSteamFarm {
await LimitLoginRequestsAsync().ConfigureAwait(false);
if (string.IsNullOrEmpty(TwoFactorCode) && HasMobileAuthenticator) {
// In this case, we can also use ASF 2FA for providing 2FA token, even if it's not required
TwoFactorCode = await BotDatabase.MobileAuthenticator.GenerateToken().ConfigureAwait(false);
}
if (!force && (!KeepRunning || SteamClient.IsConnected)) {
return;
}
@@ -1340,7 +1335,7 @@ namespace ArchiSteamFarm {
}
}
private void OnConnected(SteamClient.ConnectedCallback callback) {
private async void OnConnected(SteamClient.ConnectedCallback callback) {
if (callback == null) {
ArchiLogger.LogNullError(nameof(callback));
return;
@@ -1393,6 +1388,11 @@ namespace ArchiSteamFarm {
loginKey = CryptoHelper.Decrypt(BotConfig.PasswordFormat, loginKey);
}
if (string.IsNullOrEmpty(TwoFactorCode) && HasMobileAuthenticator) {
// In this case, we can also use ASF 2FA for providing 2FA token, even if it's not required
TwoFactorCode = await BotDatabase.MobileAuthenticator.GenerateToken().ConfigureAwait(false);
}
SteamUser.LogOnDetails logOnDetails = new SteamUser.LogOnDetails {
AuthCode = AuthCode,
CellID = Program.GlobalDatabase.CellID,