mirror of
https://github.com/Mrs4s/MiraiGo.git
synced 2025-05-05 03:23:50 +08:00
fix incoming packet error.
This commit is contained in:
parent
9c140ff469
commit
890dba3f5a
@ -1076,6 +1076,7 @@ func (c *QQClient) sendAndWait(seq uint16, pkt []byte) (interface{}, error) {
|
|||||||
func (c *QQClient) netLoop() {
|
func (c *QQClient) netLoop() {
|
||||||
reader := binary.NewNetworkReader(c.Conn)
|
reader := binary.NewNetworkReader(c.Conn)
|
||||||
retry := 0
|
retry := 0
|
||||||
|
errCount := 0
|
||||||
for c.Online {
|
for c.Online {
|
||||||
l, err := reader.ReadInt32()
|
l, err := reader.ReadInt32()
|
||||||
if err == io.EOF || err == io.ErrClosedPipe {
|
if err == io.EOF || err == io.ErrClosedPipe {
|
||||||
@ -1098,7 +1099,11 @@ func (c *QQClient) netLoop() {
|
|||||||
data, err := reader.ReadBytes(int(l) - 4)
|
data, err := reader.ReadBytes(int(l) - 4)
|
||||||
pkt, err := packets.ParseIncomingPacket(data, c.sigInfo.d2Key)
|
pkt, err := packets.ParseIncomingPacket(data, c.sigInfo.d2Key)
|
||||||
if err != nil {
|
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())
|
//log.Println("parse incoming packet error: " + err.Error())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -1110,6 +1115,7 @@ func (c *QQClient) netLoop() {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
errCount = 0
|
||||||
retry = 0
|
retry = 0
|
||||||
c.Debug("rev pkt: %v seq: %v", pkt.CommandName, pkt.SequenceId)
|
c.Debug("rev pkt: %v seq: %v", pkt.CommandName, pkt.SequenceId)
|
||||||
go func() {
|
go func() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user