Skip to content

Commit

Permalink
fix: 身份过期返回错误
Browse files Browse the repository at this point in the history
  • Loading branch information
Redmomn committed Nov 29, 2024
1 parent 5c7fa27 commit e0fdf8c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions client/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,19 @@ func (c *QQClient) netLoop() {
resp, err := c.transport.ReadResponse(data)
// pkt, err := packets.ParseIncomingPacket(data, c.sig.D2Key)
if err != nil {
c.error("parse incoming packet error: %v", err)
if errors.Is(err, network.ErrSessionExpired) || errors.Is(err, network.ErrAuthenticationFailed) || errors.Is(err, network.ErrPacketDropped) {
switch {
case errors.Is(err, network.ErrSessionExpired) || errors.Is(err, network.ErrAuthenticationFailed):
// 返回错误
go func() {
if f, ok := c.handlers.LoadAndDelete(uint32(resp.SequenceID)); ok {
// does not need decoder
f.fun(nil, err)
}
}()
case errors.Is(err, network.ErrPacketDropped):
fallthrough
default:
c.error("parse incoming packet error: %v", err)
c.Disconnect()
go c.DisconnectedEvent.dispatch(c, &DisconnectedEvent{Message: err.Error()})
continue
Expand Down

0 comments on commit e0fdf8c

Please sign in to comment.