Skip to content

Commit

Permalink
fix1
Browse files Browse the repository at this point in the history
  • Loading branch information
oq-x committed Sep 18, 2024
1 parent 46e025a commit 05aea2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions protocol/net/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 05aea2b

Please sign in to comment.