mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-23 13:50:12 +08:00
Fix IllegalStateException when losing packet
This commit is contained in:
parent
7172ef628c
commit
12c38b94fe
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user