mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-13 03:16:05 +08:00
Improve logs on reconnection
This commit is contained in:
parent
708e77bcfa
commit
ff9cc6a74e
@ -142,7 +142,9 @@ internal abstract class AbstractBot<N : BotNetworkHandler> constructor(
|
||||
// normally closed
|
||||
return@subscribeAlways
|
||||
}
|
||||
bot.logger.info { "Connection lost, retrying login" }
|
||||
|
||||
val causeMessage = event.castOrNull<BotOfflineEvent.CauseAware>()?.cause?.toString() ?: event.toString()
|
||||
bot.logger.info { "Connection lost, retrying login ($causeMessage)" }
|
||||
|
||||
bot.asQQAndroidBot().client.run {
|
||||
if (serverList.isEmpty()) {
|
||||
@ -171,9 +173,9 @@ internal abstract class AbstractBot<N : BotNetworkHandler> constructor(
|
||||
}
|
||||
|
||||
|
||||
// Close network to avoid endless reconnection while network is ok
|
||||
// https://github.com/mamoe/mirai/issues/894
|
||||
kotlin.runCatching { network.close(event.castOrNull<BotOfflineEvent.CauseAware>()?.cause) }
|
||||
// Close network to avoid endless reconnection while network is ok
|
||||
// https://github.com/mamoe/mirai/issues/894
|
||||
kotlin.runCatching { network.close(event.castOrNull<BotOfflineEvent.CauseAware>()?.cause) }
|
||||
|
||||
login()
|
||||
_network.postInitActions()
|
||||
|
Loading…
Reference in New Issue
Block a user