1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00
This commit is contained in:
Mrs4s 2020-08-19 12:15:45 +08:00
parent 14f42ec0df
commit 3561e5f156
2 changed files with 8 additions and 1 deletions

View File

@ -63,6 +63,7 @@ type QQClient struct {
lastMessageSeq int32 lastMessageSeq int32
//lastMessageSeqTmp sync.Map //lastMessageSeqTmp sync.Map
msgSvcCache *utils.Cache
lastLostMsg string lastLostMsg string
groupMsgBuilders sync.Map groupMsgBuilders sync.Map
onlinePushCache []int16 // reset on reconnect onlinePushCache []int16 // reset on reconnect
@ -142,7 +143,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
ksid: []byte("|454001228437590|A8.2.7.27f6ea96"), ksid: []byte("|454001228437590|A8.2.7.27f6ea96"),
eventHandlers: &eventHandlers{}, eventHandlers: &eventHandlers{},
groupListLock: new(sync.Mutex), groupListLock: new(sync.Mutex),
//msgSvcCache: utils.NewCache(time.Second * 5), msgSvcCache: utils.NewCache(time.Second * 5),
} }
rand.Read(cli.RandomKey) rand.Read(cli.RandomKey)
return cli return cli

View File

@ -6,6 +6,7 @@ import (
"fmt" "fmt"
"github.com/Mrs4s/MiraiGo/client/pb/pttcenter" "github.com/Mrs4s/MiraiGo/client/pb/pttcenter"
"log" "log"
"strconv"
"sync" "sync"
"sync/atomic" "sync/atomic"
"time" "time"
@ -167,6 +168,11 @@ func decodeMessageSvcPacket(c *QQClient, _ uint16, payload []byte) (interface{},
if (int64(pairMsg.LastReadTime) & 4294967295) > int64(message.Head.MsgTime) { if (int64(pairMsg.LastReadTime) & 4294967295) > int64(message.Head.MsgTime) {
continue continue
} }
strKey := strconv.FormatInt(message.Head.MsgUid, 10)
if _, ok := c.msgSvcCache.Get(strKey); ok {
continue
}
c.msgSvcCache.Add(strKey, "", time.Second*15)
switch message.Head.MsgType { switch message.Head.MsgType {
case 33: // 加群同步 case 33: // 加群同步
groupJoinLock.Lock() groupJoinLock.Lock()