mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-15 21:10:14 +08:00
Heartbeat timeout retry
This commit is contained in:
parent
b7baae570f
commit
d9c8959096
@ -473,7 +473,13 @@ internal class TIMPCBotNetworkHandler internal constructor(coroutineContext: Cor
|
||||
|
||||
HeartbeatPacket(bot.qqAccount, sessionKey).sendAndExpect<HeartbeatPacketResponse>()
|
||||
} == null) {
|
||||
|
||||
// retry one time
|
||||
if (withTimeoutOrNull(configuration.heartbeatTimeoutMillis) {
|
||||
HeartbeatPacket(bot.qqAccount, sessionKey).sendAndExpect<HeartbeatPacketResponse>()
|
||||
} == null) {
|
||||
bot.logger.warning("Heartbeat timed out")
|
||||
|
||||
delay(configuration.firstReconnectDelayMillis)
|
||||
bot.tryReinitializeNetworkHandler(HeartbeatTimeoutException())
|
||||
return@launch
|
||||
@ -481,6 +487,7 @@ internal class TIMPCBotNetworkHandler internal constructor(coroutineContext: Cor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bot.logger.info("Successfully logged in")
|
||||
loginResult.complete(null)
|
||||
|
Loading…
Reference in New Issue
Block a user