1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 11:07:40 +08:00

fix(client): fix alignment.

This commit is contained in:
wdvxdr 2021-07-15 13:20:16 +08:00
parent 4128ec65a0
commit d57f10ceae
No known key found for this signature in database
GPG Key ID: 55FF1414A69CEBA6
2 changed files with 6 additions and 6 deletions

View File

@ -34,6 +34,10 @@ var json = jsoniter.ConfigFastest
type QQClient struct {
Uin int64
PasswordMd5 [16]byte
stat Statistics
once sync.Once
AllowSlider bool
Nickname string
@ -98,7 +102,6 @@ type QQClient struct {
groupDataTransSeq int32
highwayApplyUpSeq int32
eventHandlers *eventHandlers
stat Statistics
groupListLock sync.Mutex
}
@ -426,7 +429,7 @@ func (c *QQClient) init(tokenLogin bool) error {
}
seq, pkt := c.buildGetMessageRequestPacket(msg.SyncFlag_START, time.Now().Unix())
_, _ = c.sendAndWait(seq, pkt, requestParams{"used_reg_proxy": true, "init": true})
c.stat.once.Do(func() {
c.once.Do(func() {
c.OnGroupMessage(func(_ *QQClient, _ *message.GroupMessage) {
atomic.AddUint64(&c.stat.MessageReceived, 1)
atomic.StoreInt64(&c.stat.LastMessageTime, time.Now().Unix())

View File

@ -3,7 +3,6 @@ package client
import (
"bytes"
"strconv"
"sync"
"sync/atomic"
)
@ -13,11 +12,9 @@ type Statistics struct {
PacketLost uint64
MessageReceived uint64
MessageSent uint64
LastMessageTime int64
DisconnectTimes uint32
LostTimes uint32
LastMessageTime int64
once sync.Once
}
func (s *Statistics) MarshalJSON() ([]byte, error) {