Commit d9c89590 authored by Him188's avatar Him188

Heartbeat timeout retry

parent b7baae57
......@@ -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
}
}
}
}
......
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