1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00
This commit is contained in:
LXY 2020-08-21 16:51:24 +08:00 committed by GitHub
parent eb783be51d
commit e652825266
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,7 +38,7 @@ type QQClient struct {
GroupList []*GroupInfo
Online bool
SequenceId uint16
SequenceId int32
OutGoingPacketSessionId []byte
RandomKey []byte
Conn net.Conn
@ -77,8 +77,6 @@ type QQClient struct {
groupListLock sync.Mutex
msgSvcLock sync.Mutex
seqLock sync.Mutex
}
type loginSigInfo struct {
@ -825,45 +823,27 @@ func (c *QQClient) registerClient() {
}
func (c *QQClient) nextSeq() uint16 {
c.seqLock.Lock()
defer c.seqLock.Unlock()
c.SequenceId++
c.SequenceId &= 0x7FFF
if c.SequenceId == 0 {
c.SequenceId++
}
return c.SequenceId
return uint16(atomic.AddInt32(&c.SequenceId, 1) & 0x7FFF)
}
func (c *QQClient) nextPacketSeq() int32 {
s := atomic.LoadInt32(&c.requestPacketRequestId)
atomic.AddInt32(&c.requestPacketRequestId, 2)
return s
return atomic.AddInt32(&c.requestPacketRequestId, 2)
}
func (c *QQClient) nextGroupSeq() int32 {
s := atomic.LoadInt32(&c.groupSeq)
atomic.AddInt32(&c.groupSeq, 2)
return s
return atomic.AddInt32(&c.groupSeq, 2)
}
func (c *QQClient) nextFriendSeq() int32 {
s := atomic.LoadInt32(&c.friendSeq)
atomic.AddInt32(&c.friendSeq, 1)
return s
return atomic.AddInt32(&c.friendSeq, 1)
}
func (c *QQClient) nextGroupDataTransSeq() int32 {
s := atomic.LoadInt32(&c.groupDataTransSeq)
atomic.AddInt32(&c.groupDataTransSeq, 2)
return s
return atomic.AddInt32(&c.groupDataTransSeq, 2)
}
func (c *QQClient) nextHighwayApplySeq() int32 {
s := atomic.LoadInt32(&c.highwayApplyUpSeq)
atomic.AddInt32(&c.highwayApplyUpSeq, 2)
return s
return atomic.AddInt32(&c.highwayApplyUpSeq, 2)
}
func (c *QQClient) send(pkt []byte) error {