소스 검색

#1509 try to fix bot is closed manually

Karlatemp 4 년 전
부모
커밋
72dc1e1d02
2개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 2
      mirai-core/src/commonMain/kotlin/QQAndroidBot.kt
  2. 1 1
      mirai-core/src/commonMain/kotlin/network/impl/netty/NettyNetworkHandler.kt

+ 1 - 2
mirai-core/src/commonMain/kotlin/QQAndroidBot.kt

@@ -124,8 +124,7 @@ internal open class QQAndroidBot constructor(
                     cause is NetworkException && cause.recoverable -> {
                         eventDispatcher.broadcastAsync(BotOfflineEvent.Dropped(bot, cause))
                     }
-                    cause == null ->{
-                        eventDispatcher.broadcastAsync(BotOfflineEvent.Dropped(bot, null))
+                    cause is BotClosedByEvent -> {
                     }
                     else -> {
                         // any other unexpected exceptions considered as an error

+ 1 - 1
mirai-core/src/commonMain/kotlin/network/impl/netty/NettyNetworkHandler.kt

@@ -155,7 +155,7 @@ internal open class NettyNetworkHandler(
 
         future.channel().closeFuture().addListener {
             if (_state.correspondingState == State.CLOSED) return@addListener
-            close(it.cause())
+            close(NettyChannelException(cause = it.cause()))
         }
 
         return contextResult.await()