From 05aea2b7785d5508398c499a0982118c7336b57e Mon Sep 17 00:00:00 2001 From: oq Date: Wed, 18 Sep 2024 10:51:05 +0300 Subject: [PATCH] fix1 --- protocol/net/conn.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/protocol/net/conn.go b/protocol/net/conn.go index 5a74841..836e688 100644 --- a/protocol/net/conn.go +++ b/protocol/net/conn.go @@ -235,14 +235,15 @@ func (conn *Conn) ReadPacket() (packet.Decodeable, error) { packetId = id packet = data length = int32(len(data)) + br := bytes.NewReader(packet) if PacketReadInterceptor != nil { - if PacketReadInterceptor(conn, bytes.NewReader(packet), packetId) { + if PacketReadInterceptor(conn, br, packetId) { return nil, fmt.Errorf("stopped by interceptor") } } - rd = encoding.NewReader(bytes.NewReader(packet), int(length)) + rd = encoding.NewReader(br, int(length)) } else { var packetLength int32 if _, err := rd.VarInt(&packetLength); err != nil {