From b4bb1696de6ec16ddff5e54f3e561c31a7501a89 Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 13 Apr 2022 11:50:32 +0100 Subject: [PATCH] Fix commit 'Don't mark failed if received MessageSvcPushForceOffline ' (332e03377c2ef58c243f5f3606701c1525e362b4) The original commit was to fix the problem when receiving MessageSvcPushForceOffline on first login, which calls `setLoginHalted`, and stops the login process. --- .../commonMain/kotlin/network/components/BotInitProcessor.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mirai-core/src/commonMain/kotlin/network/components/BotInitProcessor.kt b/mirai-core/src/commonMain/kotlin/network/components/BotInitProcessor.kt index bb2f5b9ac..7889fe8f0 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/BotInitProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/BotInitProcessor.kt @@ -51,6 +51,9 @@ internal interface BotInitProcessor { * * This is called in [MessageSvcPushForceOffline], which is in case connection is closed by server during the [NetworkHandler.State.LOADING] state. * + * This function only marks current initialization work has failed. It has nothing to do with result of login. + * To update that result, update `bot.components[SsoProcessor].firstLoginResult`. + * * See [BotInitProcessorImpl.state]. */ fun setLoginHalted() @@ -104,6 +107,7 @@ internal class BotInitProcessorImpl( bot.components[SsoProcessor].firstLoginResult.compareAndSet(null, FirstLoginResult.PASSED) } catch (e: Throwable) { setLoginHalted() + bot.components[SsoProcessor].firstLoginResult.compareAndSet(null, FirstLoginResult.OTHER_FAILURE) throw e } }