1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

filter c2c msg by time.

This commit is contained in:
Mrs4s 2021-05-25 09:01:01 +08:00
parent f6579d20cd
commit 8f0cd9494d
No known key found for this signature in database
GPG Key ID: 3186E98FA19CE3A7
2 changed files with 6 additions and 0 deletions

View File

@ -119,6 +119,11 @@ func (c *QQClient) commMsgProcessor(pMsg *msg.Message, info *incomingPacketInfo)
return return
} }
c.msgSvcCache.Add(strKey, "", time.Hour) c.msgSvcCache.Add(strKey, "", time.Hour)
if c.lastC2CMsgTime > int64(pMsg.Head.GetMsgTime()) && (c.lastC2CMsgTime-int64(pMsg.Head.GetMsgTime())) > 60*10 {
c.Debug("c2c msg filtered by time. lastMsgTime: %v msgTime: %v", c.lastC2CMsgTime, pMsg.Head.GetMsgTime())
return
}
c.lastC2CMsgTime = int64(pMsg.Head.GetMsgTime())
if info.Params.bool("init") { if info.Params.bool("init") {
return return
} }

View File

@ -85,6 +85,7 @@ type QQClient struct {
lastMessageSeq int32 lastMessageSeq int32
// lastMessageSeqTmp sync.Map // lastMessageSeqTmp sync.Map
msgSvcCache *utils.Cache msgSvcCache *utils.Cache
lastC2CMsgTime int64
transCache *utils.Cache transCache *utils.Cache
lastLostMsg string lastLostMsg string
groupSysMsgCache *GroupSystemMessages groupSysMsgCache *GroupSystemMessages