mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-04 09:25:23 +08:00
Try register only if possible. Close #47
This commit is contained in:
parent
1993047221
commit
a7055ed92d
@ -89,9 +89,13 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
}.also { _packetReceiverJob = it }
|
||||
}
|
||||
|
||||
|
||||
override suspend fun relogin() {
|
||||
if (::channel.isInitialized) {
|
||||
if (channel.isOpen) {
|
||||
kotlin.runCatching {
|
||||
registerClientOnline()
|
||||
}.exceptionOrNull() ?: return
|
||||
}
|
||||
channel.close()
|
||||
}
|
||||
channel = PlatformSocket()
|
||||
@ -149,10 +153,11 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
}
|
||||
|
||||
// println("d2key=${bot.client.wLoginSigInfo.d2Key.toUHexString()}")
|
||||
registerClientOnline()
|
||||
}
|
||||
|
||||
repeat(2) {
|
||||
StatSvc.Register(bot.client).sendAndExpect<StatSvc.Register.Response>(6000) // it's slow
|
||||
}
|
||||
private suspend fun registerClientOnline() {
|
||||
StatSvc.Register(bot.client).sendAndExpect<StatSvc.Register.Response>(6000) // it's slow
|
||||
}
|
||||
|
||||
@UseExperimental(MiraiExperimentalAPI::class, ExperimentalTime::class)
|
||||
|
Loading…
Reference in New Issue
Block a user