Commit a7755cd7 authored by Him188's avatar Him188

Rename `readPacket` to `readPacketExact`

parent fca3d6bd
......@@ -41,7 +41,7 @@ import net.mamoe.mirai.qqandroid.network.protocol.packet.login.WtLogin
import net.mamoe.mirai.utils.*
import net.mamoe.mirai.utils.io.ByteArrayPool
import net.mamoe.mirai.utils.io.PlatformSocket
import net.mamoe.mirai.utils.io.readPacket
import net.mamoe.mirai.utils.io.readPacketExact
import net.mamoe.mirai.utils.io.useBytes
import kotlin.coroutines.CoroutineContext
import kotlin.jvm.Volatile
......@@ -445,7 +445,7 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
}
// 循环所有完整的包
while (rawInput.remaining >= length) {
parsePacketAsync(rawInput.readPacket(length))
parsePacketAsync(rawInput.readPacketExact(length))
if (rawInput.remaining == 0L) {
cachedPacket.value = null // 表示包长度正好
......
......@@ -279,7 +279,7 @@ internal object KnownPacketFactories {
val commandName: String
val ssoSequenceId: Int
val dataCompressed: Int
input.readPacket(input.readInt() - 4).withUse {
input.readPacketExact(input.readInt() - 4).withUse {
ssoSequenceId = readInt()
PacketLogger.verbose { "sequenceId = $ssoSequenceId" }
val returnCode = readInt()
......
......@@ -56,7 +56,7 @@ inline fun <R> ByteReadPacket.useBytes(
block(it, n)
}
inline fun ByteReadPacket.readPacket(
inline fun ByteReadPacket.readPacketExact(
n: Int = remaining.toInt()//not that safe but adequate
): ByteReadPacket = this.readBytes(n).toReadPacket()
......
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