mirror of
https://github.com/AynaLivePlayer/blivedm-go.git
synced 2025-12-06 11:22:50 +08:00
maybe fix zero packet length
This commit is contained in:
@@ -54,6 +54,9 @@ func NewPlainPacket(operation int, body []byte) Packet {
|
|||||||
|
|
||||||
func NewPacketFromBytes(data []byte) Packet {
|
func NewPacketFromBytes(data []byte) Packet {
|
||||||
packLen := binary.BigEndian.Uint32(data[0:4])
|
packLen := binary.BigEndian.Uint32(data[0:4])
|
||||||
|
if packLen == 0 {
|
||||||
|
return Packet{ProtocolVersion: 99}
|
||||||
|
}
|
||||||
// 校验包长度
|
// 校验包长度
|
||||||
if int(packLen) != len(data) {
|
if int(packLen) != len(data) {
|
||||||
log.Error("error packet")
|
log.Error("error packet")
|
||||||
|
|||||||
Reference in New Issue
Block a user