1
0
mirror of https://github.com/mamoe/mirai.git synced 2025-03-30 09:50:12 +08:00

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

This commit is contained in:
Karlatemp 2022-10-20 12:56:39 +08:00
parent 1d6e6ea67d
commit 58ab562322
No known key found for this signature in database
GPG Key ID: BA173CA2B9956C59

View File

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