Browse Source

修复 Timeout waiting for ConfigPush. 掉线问题 (#2834)

赵怡然 1 năm trước cách đây
mục cha
commit
b7eb6eb88d

+ 3 - 2
mirai-core/src/commonMain/kotlin/network/components/ConfigPushProcessor.kt

@@ -16,6 +16,7 @@ import net.mamoe.mirai.event.globalEventChannel
 import net.mamoe.mirai.event.nextEvent
 import net.mamoe.mirai.event.nextEvent
 import net.mamoe.mirai.internal.network.component.ComponentKey
 import net.mamoe.mirai.internal.network.component.ComponentKey
 import net.mamoe.mirai.internal.network.handler.NetworkHandler
 import net.mamoe.mirai.internal.network.handler.NetworkHandler
+import net.mamoe.mirai.internal.network.handler.selector.NetworkException
 import net.mamoe.mirai.internal.network.protocol.packet.login.ConfigPushSvc
 import net.mamoe.mirai.internal.network.protocol.packet.login.ConfigPushSvc
 import net.mamoe.mirai.utils.MiraiLogger
 import net.mamoe.mirai.utils.MiraiLogger
 import net.mamoe.mirai.utils.warning
 import net.mamoe.mirai.utils.warning
@@ -42,7 +43,7 @@ internal class ConfigPushProcessorImpl(
         if (resp == null) {
         if (resp == null) {
             val bdhSyncer = network.context[BdhSessionSyncer]
             val bdhSyncer = network.context[BdhSessionSyncer]
             if (!bdhSyncer.hasSession) {
             if (!bdhSyncer.hasSession) {
-                val e = IllegalStateException("Timeout waiting for ConfigPush.")
+                val e = NetworkException("Timeout waiting for ConfigPush.",true)
                 bdhSyncer.bdhSession.completeExceptionally(e)
                 bdhSyncer.bdhSession.completeExceptionally(e)
                 logger.warning { "Missing ConfigPush. Switching server..." }
                 logger.warning { "Missing ConfigPush. Switching server..." }
                 network.context[SsoProcessor].casFirstLoginResult(null, FirstLoginResult.CHANGE_SERVER)
                 network.context[SsoProcessor].casFirstLoginResult(null, FirstLoginResult.CHANGE_SERVER)
@@ -56,4 +57,4 @@ internal class ConfigPushProcessorImpl(
         }
         }
     }
     }
 
 
-}
+}