Skip to content

Commit

Permalink
experimental: fix spelling mistake, fix length check logic and remove…
Browse files Browse the repository at this point in the history
… debug log
  • Loading branch information
lhridder committed Nov 29, 2022
1 parent 741607d commit 4593126
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions protocol/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"bytes"
"fmt"
"io"
"log"
"strconv"
)

// Packet is the raw representation of message that is send between the client and the server
Expand Down Expand Up @@ -59,8 +57,7 @@ func ReadPacketBytes(r DecodeReader, limit bool) ([]byte, error) {
return nil, err
}

if limit && packetLength < 1 || packetLength > 16384 {
log.Printf("Packet length invalid: %s", strconv.Itoa(int(packetLength)))
if limit && (packetLength < 1 || packetLength > 16384) {
return nil, ErrInvalidPacketLength
}

Expand Down
4 changes: 2 additions & 2 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,11 @@ func (proxy *Proxy) handleStatusConnection(conn Conn, session Session) error {

clientboundResponsePacket, err := rconn.ReadPacket(false)
if err != nil {
return fmt.Errorf("failed to read status reponse: %s", err)
return fmt.Errorf("failed to read status response: %s", err)
}
clientboundResponse, err := status.UnmarshalClientBoundResponse(clientboundResponsePacket)
if err != nil {
return fmt.Errorf("failed to unmarshal status reponse: %s", err)
return fmt.Errorf("failed to unmarshal status response: %s", err)
}

proxy.cacheOnlineStatus = true
Expand Down

0 comments on commit 4593126

Please sign in to comment.