Explorar o código

[core - JVM] [Network] Wrap exception from connecting to `NettyChannelException` to allow selector to reconnect

Karlatemp %!s(int64=3) %!d(string=hai) anos
pai
achega
58ab562322

+ 3 - 2
mirai-core/src/jvmBaseMain/kotlin/network/impl/netty/NettyNetworkHandler.kt

@@ -9,7 +9,6 @@
 
 
 package net.mamoe.mirai.internal.network.impl.netty
 package net.mamoe.mirai.internal.network.impl.netty
 
 
-import io.ktor.utils.io.core.*
 import io.netty.bootstrap.Bootstrap
 import io.netty.bootstrap.Bootstrap
 import io.netty.buffer.ByteBuf
 import io.netty.buffer.ByteBuf
 import io.netty.channel.*
 import io.netty.channel.*
@@ -113,7 +112,9 @@ internal open class NettyNetworkHandler(
             }.onFailure {
             }.onFailure {
                 eventLoopGroup.shutdownGracefully()
                 eventLoopGroup.shutdownGracefully()
                 contextResult.cancel()
                 contextResult.cancel()
-            }.getOrThrow()
+            }.getOrElse { error ->
+                throw NettyChannelException(cause = error)
+            }
 
 
         contextResult.complete(future.channel())
         contextResult.complete(future.channel())