Commit d9c89590 authored by Him188's avatar Him188

Heartbeat timeout retry

parent b7baae57
...@@ -473,10 +473,17 @@ internal class TIMPCBotNetworkHandler internal constructor(coroutineContext: Cor ...@@ -473,10 +473,17 @@ internal class TIMPCBotNetworkHandler internal constructor(coroutineContext: Cor
HeartbeatPacket(bot.qqAccount, sessionKey).sendAndExpect<HeartbeatPacketResponse>() HeartbeatPacket(bot.qqAccount, sessionKey).sendAndExpect<HeartbeatPacketResponse>()
} == null) { } == null) {
bot.logger.warning("Heartbeat timed out")
delay(configuration.firstReconnectDelayMillis) // retry one time
bot.tryReinitializeNetworkHandler(HeartbeatTimeoutException()) if (withTimeoutOrNull(configuration.heartbeatTimeoutMillis) {
return@launch HeartbeatPacket(bot.qqAccount, sessionKey).sendAndExpect<HeartbeatPacketResponse>()
} == null) {
bot.logger.warning("Heartbeat timed out")
delay(configuration.firstReconnectDelayMillis)
bot.tryReinitializeNetworkHandler(HeartbeatTimeoutException())
return@launch
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment