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