From c19265b9543990dd2a61bdb9c106c4a36717fa22 Mon Sep 17 00:00:00 2001 From: Him188 Date: Wed, 28 Jul 2021 12:17:18 +0800 Subject: [PATCH] Inline `NetworkHandler.isOk` --- mirai-core/src/commonMain/kotlin/AbstractBot.kt | 3 ++- .../src/commonMain/kotlin/network/handler/NetworkHandler.kt | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/mirai-core/src/commonMain/kotlin/AbstractBot.kt b/mirai-core/src/commonMain/kotlin/AbstractBot.kt index 6654b53c7..c07bf9558 100644 --- a/mirai-core/src/commonMain/kotlin/AbstractBot.kt +++ b/mirai-core/src/commonMain/kotlin/AbstractBot.kt @@ -23,6 +23,7 @@ import net.mamoe.mirai.internal.contact.uin import net.mamoe.mirai.internal.network.component.ComponentStorage import net.mamoe.mirai.internal.network.components.SsoProcessor import net.mamoe.mirai.internal.network.handler.NetworkHandler +import net.mamoe.mirai.internal.network.handler.NetworkHandler.State import net.mamoe.mirai.internal.network.handler.selector.NetworkException import net.mamoe.mirai.internal.network.impl.netty.asCoroutineExceptionHandler import net.mamoe.mirai.network.LoginFailedException @@ -85,7 +86,7 @@ internal abstract class AbstractBot constructor( */ abstract val components: ComponentStorage - final override val isOnline: Boolean get() = network.isOk() + final override val isOnline: Boolean get() = network.state == State.OK final override val eventChannel: EventChannel = GlobalEventChannel.filterIsInstance().filter { it.bot === this@AbstractBot } diff --git a/mirai-core/src/commonMain/kotlin/network/handler/NetworkHandler.kt b/mirai-core/src/commonMain/kotlin/network/handler/NetworkHandler.kt index 2535da8a6..e385c0604 100644 --- a/mirai-core/src/commonMain/kotlin/network/handler/NetworkHandler.kt +++ b/mirai-core/src/commonMain/kotlin/network/handler/NetworkHandler.kt @@ -38,8 +38,6 @@ import net.mamoe.mirai.utils.MiraiLogger internal interface NetworkHandler : CoroutineScope { val context: NetworkHandlerContext - fun isOk() = state == State.OK - /** * Current state of this handler. This is volatile. */