From e387d4b4a592357477c6bc241cdd90fb77e1f66f Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 6 Apr 2022 16:18:10 +0100 Subject: [PATCH] Abort first login if any error occurred. Fix #1963 --- .../network/components/BotInitProcessor.kt | 11 +++-- .../network/components/ConfigPushProcessor.kt | 9 ++-- .../kotlin/network/components/SsoProcessor.kt | 25 +++++++--- ...AbstractKeepAliveNetworkHandlerSelector.kt | 17 +++++-- .../network/impl/netty/NettyNetworkHandler.kt | 3 ++ .../framework/components/TestSsoProcessor.kt | 18 ++++--- ...KeepAliveNetworkHandlerSelectorRealTest.kt | 19 ++++++-- .../network/handler/SelectorRecoveryTest.kt | 12 +++-- .../impl/netty/NettyBotNormalLoginTest.kt | 48 ++++++++++++------- .../impl/netty/NettyHandlerEventTest.kt | 8 ++-- .../processors/AbstractNoticeProcessorTest.kt | 3 +- .../notice/processors/MessageSyncTest.kt | 4 +- .../kotlin/notice/processors/MessageTest.kt | 8 +--- 13 files changed, 116 insertions(+), 69 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/network/components/BotInitProcessor.kt b/mirai-core/src/commonMain/kotlin/network/components/BotInitProcessor.kt index 7cd5eb2b0..ef4a827f4 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/BotInitProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/BotInitProcessor.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.components @@ -78,6 +78,7 @@ internal class BotInitProcessorImpl( override fun setLoginHalted() { state.compareAndSet(expect = INITIALIZING, update = UNINITIALIZED) + bot.components[SsoProcessor].firstLoginResult.compareAndSet(null, FirstLoginResult.OTHER_FAILURE) } override suspend fun init() { @@ -101,7 +102,7 @@ internal class BotInitProcessorImpl( } state.value = INITIALIZED - bot.components[SsoProcessor].firstLoginSucceed = true + bot.components[SsoProcessor].firstLoginResult.compareAndSet(null, FirstLoginResult.PASSED) } catch (e: Throwable) { setLoginHalted() throw e diff --git a/mirai-core/src/commonMain/kotlin/network/components/ConfigPushProcessor.kt b/mirai-core/src/commonMain/kotlin/network/components/ConfigPushProcessor.kt index b8a120c64..45c6e18a0 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/ConfigPushProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/ConfigPushProcessor.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.components @@ -36,6 +36,7 @@ internal class ConfigPushProcessorImpl( val e = IllegalStateException("Timeout waiting for ConfigPush.") bdhSyncer.bdhSession.completeExceptionally(e) logger.warning { "Missing ConfigPush. Switching server..." } + network.context[SsoProcessor].firstLoginResult.compareAndSet(null, FirstLoginResult.CHANGE_SERVER) network.context.bot.components[EventDispatcher].broadcastAsync( BotOfflineEvent.RequireReconnect( network.context.bot, diff --git a/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt b/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt index 865820c1c..d54c60df6 100644 --- a/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt +++ b/mirai-core/src/commonMain/kotlin/network/components/SsoProcessor.kt @@ -1,14 +1,16 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.components +import kotlinx.atomicfu.AtomicRef +import kotlinx.atomicfu.atomic import net.mamoe.mirai.internal.QQAndroidBot import net.mamoe.mirai.internal.network.Packet import net.mamoe.mirai.internal.network.QQAndroidClient @@ -38,7 +40,8 @@ internal interface SsoProcessor { val client: QQAndroidClient val ssoSession: SsoSession - var firstLoginSucceed: Boolean + val firstLoginResult: AtomicRef // null means just initialized + val firstLoginSucceed: Boolean get() = firstLoginResult.value?.success ?: false val registerResp: StatSvc.Register.Response? /** @@ -54,6 +57,15 @@ internal interface SsoProcessor { companion object : ComponentKey } +internal enum class FirstLoginResult( + val success: Boolean, + val canRecoverOnFirstLogin: Boolean, +) { + PASSED(true, true), + CHANGE_SERVER(false, true), // by ConfigPush + OTHER_FAILURE(false, false), +} + /** * Contains secrets for encryption and decryption during a session created by [SsoProcessor] and [PacketCodec]. * @@ -87,8 +99,7 @@ internal class SsoProcessorImpl( // public /////////////////////////////////////////////////////////////////////////// - @Volatile - override var firstLoginSucceed: Boolean = false + override val firstLoginResult: AtomicRef = atomic(null) @Volatile override var registerResp: StatSvc.Register.Response? = null diff --git a/mirai-core/src/commonMain/kotlin/network/handler/selector/AbstractKeepAliveNetworkHandlerSelector.kt b/mirai-core/src/commonMain/kotlin/network/handler/selector/AbstractKeepAliveNetworkHandlerSelector.kt index d95b63f4e..b8c8a5896 100644 --- a/mirai-core/src/commonMain/kotlin/network/handler/selector/AbstractKeepAliveNetworkHandlerSelector.kt +++ b/mirai-core/src/commonMain/kotlin/network/handler/selector/AbstractKeepAliveNetworkHandlerSelector.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.handler.selector @@ -14,6 +14,7 @@ import kotlinx.coroutines.currentCoroutineContext import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import kotlinx.coroutines.yield +import net.mamoe.mirai.internal.network.components.SsoProcessor import net.mamoe.mirai.internal.network.handler.NetworkHandler import net.mamoe.mirai.internal.network.handler.NetworkHandlerFactory import net.mamoe.mirai.internal.network.handler.logger @@ -95,6 +96,14 @@ internal abstract class AbstractKeepAliveNetworkHandlerSelector = atomic(null) override var registerResp: StatSvc.Register.Response? = null override suspend fun login(handler: NetworkHandler) { - firstLoginSucceed = true bot.network.logger.debug { "SsoProcessor.login" } } diff --git a/mirai-core/src/commonTest/kotlin/network/handler/KeepAliveNetworkHandlerSelectorRealTest.kt b/mirai-core/src/commonTest/kotlin/network/handler/KeepAliveNetworkHandlerSelectorRealTest.kt index 8de57c46e..05425ebf7 100644 --- a/mirai-core/src/commonTest/kotlin/network/handler/KeepAliveNetworkHandlerSelectorRealTest.kt +++ b/mirai-core/src/commonTest/kotlin/network/handler/KeepAliveNetworkHandlerSelectorRealTest.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ @file:OptIn(TestOnly::class) @@ -12,14 +12,18 @@ package net.mamoe.mirai.internal.network.handler import io.netty.channel.Channel +import net.mamoe.mirai.internal.network.components.FirstLoginResult +import net.mamoe.mirai.internal.network.components.SsoProcessor import net.mamoe.mirai.internal.network.framework.AbstractNettyNHTest import net.mamoe.mirai.internal.network.framework.TestNettyNH import net.mamoe.mirai.internal.network.handler.selector.MaxAttemptsReachedException import net.mamoe.mirai.internal.network.handler.selector.NetworkException import net.mamoe.mirai.internal.test.runBlockingUnit import net.mamoe.mirai.utils.TestOnly +import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.assertThrows import kotlin.test.Test +import kotlin.test.assertEquals import kotlin.test.assertIs internal class KeepAliveNetworkHandlerSelectorRealTest : AbstractNettyNHTest() { @@ -48,6 +52,13 @@ internal class KeepAliveNetworkHandlerSelectorRealTest : AbstractNettyNHTest() { assertThrows { selector.awaitResumeInstance() } } + // Since #1963, any error during first login will close the bot. So we assume first login succeed to do our test. + @BeforeEach + private fun setFirstLoginPassed() { + assertEquals(null, bot.components[SsoProcessor].firstLoginResult.value) + bot.components[SsoProcessor].firstLoginResult.value = FirstLoginResult.PASSED + } + @Test fun `should tolerant NetworkException thrown by states`() = runBlockingUnit { // selector should not tolerant any exception during state initialization, or in the Jobs launched in states. diff --git a/mirai-core/src/commonTest/kotlin/network/handler/SelectorRecoveryTest.kt b/mirai-core/src/commonTest/kotlin/network/handler/SelectorRecoveryTest.kt index 3053b6666..e489e6a0d 100644 --- a/mirai-core/src/commonTest/kotlin/network/handler/SelectorRecoveryTest.kt +++ b/mirai-core/src/commonTest/kotlin/network/handler/SelectorRecoveryTest.kt @@ -1,10 +1,10 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.handler @@ -22,6 +22,9 @@ import org.junit.jupiter.api.Test import java.io.IOException import kotlin.test.assertFails +/** + * Test whether the selector can recover the connection after first successful login. + */ internal class SelectorRecoveryTest : AbstractNettyNHTestWithSelector() { @Test fun `stop on manual close`() = runBlockingUnit { @@ -79,6 +82,7 @@ internal class SelectorRecoveryTest : AbstractNettyNHTestWithSelector() { overrideComponents[HeartbeatScheduler] = heartbeatScheduler bot.login() + // Now first login succeed. bot.network.context[EventDispatcher].joinBroadcast() assertState(NetworkHandler.State.OK) diff --git a/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyBotNormalLoginTest.kt b/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyBotNormalLoginTest.kt index 2dd638a13..4defc4983 100644 --- a/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyBotNormalLoginTest.kt +++ b/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyBotNormalLoginTest.kt @@ -1,15 +1,14 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * - * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. - * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. + * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. + * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. * - * https://github.com/mamoe/mirai/blob/master/LICENSE + * https://github.com/mamoe/mirai/blob/dev/LICENSE */ package net.mamoe.mirai.internal.network.impl.netty -import kotlinx.coroutines.awaitCancellation import kotlinx.coroutines.delay import kotlinx.coroutines.isActive import net.mamoe.mirai.internal.network.components.BotOfflineEventMonitor @@ -62,20 +61,37 @@ internal class NettyBotNormalLoginTest : AbstractNettyNHTest() { assertFalse(bot.isActive) } + // #1963 @Test - fun `test network broken`() = runBlockingUnit { - var retryCounter = 0 - setSsoProcessor { - eventDispatcher.joinBroadcast() - if (retryCounter++ >= 15) { - return@setSsoProcessor - } - channel.pipeline().fireExceptionCaught(IOException("TestNetworkBroken")) - awaitCancellation() // receive exception from "network" - } - bot.login() + fun `test first login failure with internally handled exceptions`() = runBlockingUnit { + setSsoProcessor { throw IOException("test Connection reset by peer") } + assertFailsWith("test Connection reset by peer") { bot.login() } + assertState(NetworkHandler.State.CLOSED) } + // #1963 + @Test + fun `test first login failure with internally handled exceptions2`() = runBlockingUnit { + setSsoProcessor { throw NettyChannelException("test Connection reset by peer") } + assertFailsWith("test Connection reset by peer") { bot.login() } + assertState(NetworkHandler.State.CLOSED) + } + + // 经过 #1963 考虑后在初次登录遇到任何错误都终止并传递异常 +// @Test +// fun `test network broken`() = runBlockingUnit { +// var retryCounter = 0 +// setSsoProcessor { +// eventDispatcher.joinBroadcast() +// if (retryCounter++ >= 15) { +// return@setSsoProcessor +// } +// channel.pipeline().fireExceptionCaught(IOException("TestNetworkBroken")) +// awaitCancellation() // receive exception from "network" +// } +// bot.login() +// } + @Test fun `test resume after MsfOffline received`() = runBlockingUnit { bot.login() diff --git a/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyHandlerEventTest.kt b/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyHandlerEventTest.kt index 52cf5dc29..34becd928 100644 --- a/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyHandlerEventTest.kt +++ b/mirai-core/src/commonTest/kotlin/network/impl/netty/NettyHandlerEventTest.kt @@ -16,11 +16,11 @@ import net.mamoe.mirai.event.broadcast import net.mamoe.mirai.event.events.BotOfflineEvent import net.mamoe.mirai.event.events.BotOnlineEvent import net.mamoe.mirai.event.events.BotReloginEvent +import net.mamoe.mirai.internal.network.components.FirstLoginResult import net.mamoe.mirai.internal.network.components.SsoProcessor import net.mamoe.mirai.internal.network.framework.AbstractNettyNHTest import net.mamoe.mirai.internal.network.framework.eventDispatcher import net.mamoe.mirai.internal.network.framework.setSsoProcessor -import net.mamoe.mirai.internal.network.framework.ssoProcessor import net.mamoe.mirai.internal.network.handler.NetworkHandler.State.* import net.mamoe.mirai.internal.test.assertEventBroadcasts import net.mamoe.mirai.internal.test.assertEventNotBroadcast @@ -50,7 +50,7 @@ internal class NettyHandlerEventTest : AbstractNettyNHTest() { fun `BotOnlineEvent after successful reconnection`() = runBlockingUnit { assertEquals(INITIALIZED, network.state) bot.login() - bot.components[SsoProcessor].firstLoginSucceed = true + bot.components[SsoProcessor].firstLoginResult.value = FirstLoginResult.PASSED assertEquals(OK, network.state) eventDispatcher.joinBroadcast() // `login` launches a job which broadcasts the event assertEventBroadcasts(1) { @@ -65,7 +65,7 @@ internal class NettyHandlerEventTest : AbstractNettyNHTest() { fun `BotOfflineEvent after successful reconnection`() = runBlockingUnit { assertEquals(INITIALIZED, network.state) bot.login() - bot.components[SsoProcessor].firstLoginSucceed = true + bot.components[SsoProcessor].firstLoginResult.value = FirstLoginResult.PASSED assertEquals(OK, network.state) eventDispatcher.joinBroadcast() // `login` launches a job which broadcasts the event assertEventBroadcasts(1) { @@ -174,7 +174,7 @@ internal class NettyHandlerEventTest : AbstractNettyNHTest() { assertState(INITIALIZED) bot.login() assertState(OK) - network.ssoProcessor.firstLoginSucceed = true + bot.components[SsoProcessor].firstLoginResult.value = FirstLoginResult.PASSED network.setStateConnecting() network.resumeConnection() assertState(OK) diff --git a/mirai-core/src/commonTest/kotlin/notice/processors/AbstractNoticeProcessorTest.kt b/mirai-core/src/commonTest/kotlin/notice/processors/AbstractNoticeProcessorTest.kt index 89a5954f5..4d7b3c0b0 100644 --- a/mirai-core/src/commonTest/kotlin/notice/processors/AbstractNoticeProcessorTest.kt +++ b/mirai-core/src/commonTest/kotlin/notice/processors/AbstractNoticeProcessorTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -59,6 +59,7 @@ internal abstract class AbstractNoticeProcessorTest : AbstractNettyNHTest(), Gro pipeline: NoticeProcessorPipeline = bot.components.noticeProcessorPipeline, block: UseTestContext.() -> ProtocolStruct ): ProcessResult { + bot.components[SsoProcessor].firstLoginResult.value = FirstLoginResult.PASSED val handler = LoggingPacketHandlerAdapter(PacketLoggingStrategyImpl(bot), bot.logger) val context = UseTestContext(attributes.toMutableTypeSafeMap()) return pipeline.process(bot, block(context), context.attributes).also { list -> diff --git a/mirai-core/src/commonTest/kotlin/notice/processors/MessageSyncTest.kt b/mirai-core/src/commonTest/kotlin/notice/processors/MessageSyncTest.kt index 820863d76..c05d53ea2 100644 --- a/mirai-core/src/commonTest/kotlin/notice/processors/MessageSyncTest.kt +++ b/mirai-core/src/commonTest/kotlin/notice/processors/MessageSyncTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -14,7 +14,6 @@ import net.mamoe.mirai.contact.MemberPermission import net.mamoe.mirai.event.events.FriendMessageSyncEvent import net.mamoe.mirai.event.events.GroupMessageSyncEvent import net.mamoe.mirai.internal.network.components.NoticePipelineContext.Companion.KEY_FROM_SYNC -import net.mamoe.mirai.internal.network.components.SsoProcessor import net.mamoe.mirai.message.data.content import org.junit.jupiter.api.Test import kotlin.test.assertEquals @@ -115,7 +114,6 @@ internal class MessageSyncTest : AbstractNoticeProcessorTest() { @Test suspend fun `can receive friend sync from macOS client`() { suspend fun runTest() = use { - bot.components[SsoProcessor].firstLoginSucceed = true attributes[KEY_FROM_SYNC] = true net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm.Msg( diff --git a/mirai-core/src/commonTest/kotlin/notice/processors/MessageTest.kt b/mirai-core/src/commonTest/kotlin/notice/processors/MessageTest.kt index a2aa2d1b4..d6b7ffc16 100644 --- a/mirai-core/src/commonTest/kotlin/notice/processors/MessageTest.kt +++ b/mirai-core/src/commonTest/kotlin/notice/processors/MessageTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2019-2021 Mamoe Technologies and contributors. + * Copyright 2019-2022 Mamoe Technologies and contributors. * * 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证. * Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link. @@ -17,7 +17,6 @@ import net.mamoe.mirai.event.events.FriendMessageEvent import net.mamoe.mirai.event.events.GroupMessageEvent import net.mamoe.mirai.event.events.GroupTempMessageEvent import net.mamoe.mirai.internal.network.components.NoticePipelineContext.Companion.KEY_FROM_SYNC -import net.mamoe.mirai.internal.network.components.SsoProcessor import net.mamoe.mirai.message.data.MessageSource import net.mamoe.mirai.message.data.OnlineMessageSource import net.mamoe.mirai.message.data.PlainText @@ -135,7 +134,6 @@ internal class MessageTest : AbstractNoticeProcessorTest() { @Test suspend fun `friend message test`() { suspend fun runTest() = use(KEY_FROM_SYNC to false) { - bot.components[SsoProcessor].firstLoginSucceed = true net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm.Msg( msgHead = net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm.MsgHead( fromUin = 1230001, @@ -216,8 +214,6 @@ internal class MessageTest : AbstractNoticeProcessorTest() { @Test suspend fun `group temp message test`() { suspend fun runTest() = use(KEY_FROM_SYNC to false) { - bot.components[SsoProcessor].firstLoginSucceed = true - net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm.Msg( msgHead = net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm.MsgHead( fromUin = 1230001, @@ -312,8 +308,6 @@ internal class MessageTest : AbstractNoticeProcessorTest() { @Test suspend fun `group temp message test for issue 1410`() { suspend fun runTest() = use(KEY_FROM_SYNC to false) { - bot.components[SsoProcessor].firstLoginSucceed = true - net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm.Msg( msgHead = net.mamoe.mirai.internal.network.protocol.data.proto.MsgComm.MsgHead( fromUin = 1230001,