1
0
mirror of https://github.com/Mrs4s/MiraiGo.git synced 2025-05-04 19:17:38 +08:00

fix incoming packet error.

This commit is contained in:
Mrs4s 2020-10-09 16:28:33 +08:00
parent 9c140ff469
commit 890dba3f5a

View File

@ -1076,6 +1076,7 @@ func (c *QQClient) sendAndWait(seq uint16, pkt []byte) (interface{}, error) {
func (c *QQClient) netLoop() {
reader := binary.NewNetworkReader(c.Conn)
retry := 0
errCount := 0
for c.Online {
l, err := reader.ReadInt32()
if err == io.EOF || err == io.ErrClosedPipe {
@ -1098,7 +1099,11 @@ func (c *QQClient) netLoop() {
data, err := reader.ReadBytes(int(l) - 4)
pkt, err := packets.ParseIncomingPacket(data, c.sigInfo.d2Key)
if err != nil {
c.Error("parse incoming packer error: %v", err)
c.Error("parse incoming packet error: %v", err)
errCount++
if errCount > 5 {
c.Online = false
}
//log.Println("parse incoming packet error: " + err.Error())
continue
}
@ -1110,6 +1115,7 @@ func (c *QQClient) netLoop() {
continue
}
}
errCount = 0
retry = 0
c.Debug("rev pkt: %v seq: %v", pkt.CommandName, pkt.SequenceId)
go func() {