mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-06 00:50:13 +08:00
Fix duplication filtering in OnlinePushReqPush. close #527
This commit is contained in:
parent
ac7dcbd070
commit
21d26a2760
@ -192,8 +192,6 @@ internal open class QQAndroidClient(
|
||||
private val highwayDataTransSequenceIdForApplyUp: AtomicInt = atomic(77918)
|
||||
internal fun nextHighwayDataTransSequenceIdForApplyUp(): Int = highwayDataTransSequenceIdForApplyUp.getAndAdd(2)
|
||||
|
||||
internal val onlinePushCacheList: AtomicResizeCacheList<Short> = AtomicResizeCacheList(20.secondsToMillis)
|
||||
|
||||
val appClientVersion: Int = 0
|
||||
|
||||
var networkType: NetworkType = NetworkType.WIFI
|
||||
@ -237,6 +235,14 @@ internal open class QQAndroidClient(
|
||||
)
|
||||
|
||||
val pbPushTransMsgCacheList = SyncingCacheList<PbPushTransMsgSyncId>(10)
|
||||
|
||||
internal data class OnlinePushReqPushSyncId(
|
||||
val uid: Long,
|
||||
val sequence: Short,
|
||||
val time: Long
|
||||
)
|
||||
|
||||
val onlinePushReqPushCacheList = SyncingCacheList<OnlinePushReqPushSyncId>(50)
|
||||
}
|
||||
|
||||
val syncingController = MessageSvcSyncData()
|
||||
|
@ -67,7 +67,11 @@ internal object OnlinePushReqPush : IncomingPacketFactory<OnlinePushReqPush.ReqP
|
||||
mapper: ByteReadPacket.(msgInfo: MsgInfo) -> Sequence<Packet>
|
||||
): Sequence<Packet> {
|
||||
return asSequence().filter { msg ->
|
||||
client.onlinePushCacheList.ensureNoDuplication(msg.shMsgSeq)
|
||||
!client.syncingController.onlinePushReqPushCacheList.addCache(
|
||||
QQAndroidClient.MessageSvcSyncData.OnlinePushReqPushSyncId(
|
||||
uid = msg.lMsgUid ?: 0, sequence = msg.shMsgSeq, time = msg.uMsgTime
|
||||
)
|
||||
)
|
||||
}.flatMap { it.vMsg.read { mapper(it) } }
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user