mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-25 06:50:09 +08:00
Try to fix VerifyError
This commit is contained in:
parent
01963f3545
commit
493c52ce32
@ -67,13 +67,15 @@ abstract class PacketFactory<out TPacket : Packet, TDecrypter : Decrypter>(val d
|
||||
companion object {
|
||||
private val sequenceId: AtomicInt = atomic(1)
|
||||
|
||||
fun atomicNextSequenceId(): UShort {
|
||||
fun atomicNextSequenceId(): UShort = atomicNextSequenceId0().toUShort()
|
||||
|
||||
private fun atomicNextSequenceId0(): Int {
|
||||
val id = sequenceId.getAndAdd(1)
|
||||
if (id > Short.MAX_VALUE.toInt() * 2) {
|
||||
sequenceId.value = 0
|
||||
return atomicNextSequenceId()
|
||||
return sequenceId.getAndAdd(1)
|
||||
}
|
||||
return id.toUShort()
|
||||
return id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user