mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-13 11:30:13 +08:00
Heartbeat timeout retry
This commit is contained in:
parent
b7baae570f
commit
d9c8959096
@ -473,10 +473,17 @@ internal class TIMPCBotNetworkHandler internal constructor(coroutineContext: Cor
|
||||
|
||||
HeartbeatPacket(bot.qqAccount, sessionKey).sendAndExpect<HeartbeatPacketResponse>()
|
||||
} == null) {
|
||||
bot.logger.warning("Heartbeat timed out")
|
||||
delay(configuration.firstReconnectDelayMillis)
|
||||
bot.tryReinitializeNetworkHandler(HeartbeatTimeoutException())
|
||||
return@launch
|
||||
|
||||
// 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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user