From c497ed5617c40eb7b2b38891a3e587f6b70016ad Mon Sep 17 00:00:00 2001 From: aynakeya Date: Sat, 21 Sep 2024 20:13:04 -0700 Subject: [PATCH] maybe fix zero packet length --- packet/packet.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packet/packet.go b/packet/packet.go index 5791e00..87f50cb 100644 --- a/packet/packet.go +++ b/packet/packet.go @@ -54,6 +54,9 @@ func NewPlainPacket(operation int, body []byte) Packet { func NewPacketFromBytes(data []byte) Packet { packLen := binary.BigEndian.Uint32(data[0:4]) + if packLen == 0 { + return Packet{ProtocolVersion: 99} + } // 校验包长度 if int(packLen) != len(data) { log.Error("error packet")