mirror of
https://github.com/mamoe/mirai.git
synced 2025-03-06 09:00:14 +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)
|
private val highwayDataTransSequenceIdForApplyUp: AtomicInt = atomic(77918)
|
||||||
internal fun nextHighwayDataTransSequenceIdForApplyUp(): Int = highwayDataTransSequenceIdForApplyUp.getAndAdd(2)
|
internal fun nextHighwayDataTransSequenceIdForApplyUp(): Int = highwayDataTransSequenceIdForApplyUp.getAndAdd(2)
|
||||||
|
|
||||||
internal val onlinePushCacheList: AtomicResizeCacheList<Short> = AtomicResizeCacheList(20.secondsToMillis)
|
|
||||||
|
|
||||||
val appClientVersion: Int = 0
|
val appClientVersion: Int = 0
|
||||||
|
|
||||||
var networkType: NetworkType = NetworkType.WIFI
|
var networkType: NetworkType = NetworkType.WIFI
|
||||||
@ -237,6 +235,14 @@ internal open class QQAndroidClient(
|
|||||||
)
|
)
|
||||||
|
|
||||||
val pbPushTransMsgCacheList = SyncingCacheList<PbPushTransMsgSyncId>(10)
|
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()
|
val syncingController = MessageSvcSyncData()
|
||||||
|
@ -67,7 +67,11 @@ internal object OnlinePushReqPush : IncomingPacketFactory<OnlinePushReqPush.ReqP
|
|||||||
mapper: ByteReadPacket.(msgInfo: MsgInfo) -> Sequence<Packet>
|
mapper: ByteReadPacket.(msgInfo: MsgInfo) -> Sequence<Packet>
|
||||||
): Sequence<Packet> {
|
): Sequence<Packet> {
|
||||||
return asSequence().filter { msg ->
|
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) } }
|
}.flatMap { it.vMsg.read { mapper(it) } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user