粗略阅读了下Mirai的代码
在closeEverythingAndRelogin中launch的key refresh job似乎并不会被cancel
在重连时相关Content似乎也不会被close & renew
这是特意为之还是bug?

heartbeat job等似乎是手动cancel的:
QQAndroidBotNetworkHandler.kt#L121-L125

override suspend fun closeEverythingAndRelogin(host: String, port: Int, cause: Throwable?, step: Int) { heartbeatJob?.cancel(CancellationException("relogin", cause)) heartbeatJob?.join() _packetReceiverJob?.cancel(CancellationException("relogin", cause)) _packetReceiverJob?.join()

key refresh job创建后没有保留对Job的引用
QQAndroidBotNetworkHandler.kt#L270-L283

launch { while (isActive) { bot.client.wLoginSigInfo.sKey.run { val delay = (expireTime - creationTime).seconds - 5.minutes logger.info { "Scheduled key refresh in ${delay.toHumanReadableString()}." } delay(delay) } runCatching { refreshKeys() }.onFailure { logger.error("Failed to refresh key.", it) } } }