Heartbeat timeout retry

This commit is contained in:
Him188 2020-01-03 19:07:48 +08:00
parent b7baae570f
commit d9c8959096

View File

@ -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)