Skip to content

Commit

Permalink
rf: remove fixed seq
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrs4s committed Apr 5, 2023
1 parent f8d9841 commit 22ff004
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func NewClientMd5(uin int64, passwordMd5 [16]byte) *QQClient {
cli.transport = &network.Transport{Sig: cli.sig}
cli.oicq = oicq.NewCodec(cli.Uin)
{ // init atomic values
cli.SequenceId.Store(0x3635)
cli.SequenceId.Store(int32(rand.Intn(100000)))
cli.requestPacketRequestID.Store(1921334513)
cli.groupSeq.Store(int32(rand.Intn(20000)))
cli.friendSeq.Store(22911)
Expand Down Expand Up @@ -764,7 +764,12 @@ func (c *QQClient) registerClient() error {
}

func (c *QQClient) nextSeq() uint16 {
return uint16(c.SequenceId.Add(1) & 0x7FFF)
seq := c.SequenceId.Add(1)
if seq > 1000000 {
seq = int32(rand.Intn(100000)) + 60000
c.SequenceId.Store(seq)
}
return uint16(seq)
}

func (c *QQClient) nextPacketSeq() int32 {
Expand Down

0 comments on commit 22ff004

Please sign in to comment.