mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
Simplify
This commit is contained in:
parent
66fb009627
commit
ab98206d18
@ -42,11 +42,7 @@ internal abstract class PacketFactory<out TPacket : Packet, TDecrypter : Decrypt
|
||||
}
|
||||
|
||||
@JvmName("decode0")
|
||||
private suspend inline fun <P : Packet> PacketFactory<P, *>.decode(bot: QQAndroidBot, packet: ByteReadPacket): P {
|
||||
return this.run {
|
||||
packet.decode(bot)
|
||||
}
|
||||
}
|
||||
private suspend inline fun <P : Packet> PacketFactory<P, *>.decode(bot: QQAndroidBot, packet: ByteReadPacket): P = packet.decode(bot)
|
||||
|
||||
private val DECRYPTER_16_ZERO = ByteArray(16)
|
||||
|
||||
|
@ -189,7 +189,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse, Log
|
||||
val subCommand = readShort().toInt()
|
||||
println("subCommand=$subCommand")
|
||||
val type = readByte()
|
||||
println("type=$subCommand")
|
||||
println("type=$type")
|
||||
debugDiscardExact(3)
|
||||
val tlvMap: Map<Int, ByteArray> = this.readTLVMap()
|
||||
|
||||
|
@ -103,7 +103,7 @@ fun Input.readTLVMap(expectingEOF: Boolean = true, tagSize: Int): MutableMap<Int
|
||||
}
|
||||
try {
|
||||
map[type] = this.readUShortLVByteArray()
|
||||
} catch (e: RuntimeException) { // BufferUnderflowException
|
||||
} catch (e: Exception) { // BufferUnderflowException, java.io.EOFException
|
||||
if (expectingEOF) {
|
||||
return map
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user