Inline NetworkHandler.isOk

This commit is contained in:
Him188 2021-07-28 12:17:18 +08:00
parent 394f45fa9e
commit c19265b954
2 changed files with 2 additions and 3 deletions

View File

@ -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<BotEvent> =
GlobalEventChannel.filterIsInstance<BotEvent>().filter { it.bot === this@AbstractBot }

View File

@ -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.
*/