Commit f85a6cd5 authored by Him188's avatar Him188

Add fast-fail on packet loss

parent c044c64b
......@@ -226,6 +226,10 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
if (cache == null) {
// 没有缓存
var length: Int = rawInput.readInt() - 4
if (length < 0) {
// 丢包了. 后半部分包提前到达
return
}
if (rawInput.remaining == length.toLong()) {
// 捷径: 当包长度正好, 直接传递剩余数据.
cachedPacketTimeoutJob?.cancel()
......
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