We used user initiated before as a neat way to let plugins know that the disconnection was initiated by us. Since we use it in other situations now, namely as a result of failed login, we can't do it like this anymore. Instead, trust last log on result, and set it to OK where the disconnection was clean and expected.
This commit is contained in:
Archi
2023-05-05 19:53:45 +02:00
parent 2448ae5531
commit cca70f33e5

View File

@@ -1848,6 +1848,8 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
return;
}
LastLogOnResult = EResult.Invalid;
ArchiLogger.LogGenericInfo(Strings.BotConnecting);
InitConnectionFailureTimer();
SteamClient.Connect();
@@ -1873,6 +1875,8 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
private void Disconnect() {
StopConnectionFailureTimer();
LastLogOnResult = EResult.OK;
SteamClient.Disconnect();
}
@@ -2578,7 +2582,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable {
FirstTradeSent = false;
OwnedPackageIDs = ImmutableDictionary<uint, (EPaymentMethod PaymentMethod, DateTime TimeCreated)>.Empty;
await PluginsCore.OnBotDisconnected(this, callback.UserInitiated ? EResult.OK : lastLogOnResult).ConfigureAwait(false);
await PluginsCore.OnBotDisconnected(this, lastLogOnResult).ConfigureAwait(false);
// If we initiated disconnect, do not attempt to reconnect
if (callback.UserInitiated && !ReconnectOnUserInitiated) {