Commit 12c38b94 authored by Him188's avatar Him188

Fix IllegalStateException when losing packet

parent 7172ef62
......@@ -531,6 +531,7 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
val cache = cachedPacket.value
if (cache == null) {
kotlin.runCatching {
// 没有缓存
var length: Int = rawInput.readInt() - 4
if (rawInput.remaining == length.toLong()) {
......@@ -560,6 +561,10 @@ internal class QQAndroidBotNetworkHandler(coroutineContext: CoroutineContext, bo
cachedPacketTimeoutJob?.cancel()
return
}
}.getOrElse {
cachedPacket.value = null
cachedPacketTimeoutJob?.cancel()
}
} else {
// 有缓存
val expectingLength = expectingRemainingLength
......
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