Skip to content

Commit 7ca69c1

Browse files
author
Brian Ollenberger
committed
Increase read buffer size to capture the full possible size of a header.
1 parent b80167f commit 7ca69c1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

protocol.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ func (p *Listener) Addr() net.Addr {
153153
func NewConn(conn net.Conn, opts ...func(*Conn)) *Conn {
154154
// For v1 the header length is at most 108 bytes.
155155
// For v2 the header length is at most 52 bytes plus the length of the TLVs.
156-
// We use 256 bytes to be safe.
157-
const bufSize = 256
156+
// We use 65535, as it's the maximum length representable by a uint16.
157+
const bufSize = 65535
158158
br := bufio.NewReaderSize(conn, bufSize)
159159

160160
pConn := &Conn{

0 commit comments

Comments
 (0)