mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-04 11:07:40 +08:00
use LoadAndDelete
This commit is contained in:
parent
c07a8a9c8a
commit
01c133ebec
@ -1016,13 +1016,11 @@ func (c *QQClient) netLoop() {
|
||||
if err != nil {
|
||||
c.Debug("decode pkt %v error: %+v", pkt.CommandName, err)
|
||||
}
|
||||
if f, ok := c.handlers.Load(pkt.SequenceId); ok {
|
||||
c.handlers.Delete(pkt.SequenceId)
|
||||
if f, ok := c.handlers.LoadAndDelete(pkt.SequenceId); ok {
|
||||
f.(func(i interface{}, err error))(rsp, err)
|
||||
}
|
||||
} else if f, ok := c.handlers.Load(pkt.SequenceId); ok {
|
||||
} else if f, ok := c.handlers.LoadAndDelete(pkt.SequenceId); ok {
|
||||
// does not need decoder
|
||||
c.handlers.Delete(pkt.SequenceId)
|
||||
f.(func(i interface{}, err error))(nil, nil)
|
||||
} else {
|
||||
c.Debug("\nUnhandled Command: %s\nSeq: %d\nThis message can be ignored.", pkt.CommandName, pkt.SequenceId)
|
||||
|
@ -2,8 +2,9 @@ package client
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/notify"
|
||||
"strconv"
|
||||
|
||||
"github.com/Mrs4s/MiraiGo/client/pb/notify"
|
||||
)
|
||||
|
||||
type (
|
||||
|
Loading…
x
Reference in New Issue
Block a user