Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -542,21 +542,22 @@
return io.Copy(w, p.conn)
}

b := make([]byte, p.bufReader.Buffered())
if _, err := io.ReadFull(p.bufReader, b); err != nil {
b, err := p.bufReader.Peek(p.bufReader.Buffered())
if err != nil {
return 0, err // this should never happen as we read buffered data.
}

// Garbage collect the buffer.
p.bufReader = nil

var n int64
{
nn, err := w.Write(b)
p.bufReader.Discard(nn)

Check failure on line 553 in protocol.go

View workflow job for this annotation

GitHub Actions / lint (1.26)

Error return value of `p.bufReader.Discard` is not checked (errcheck)

Check failure on line 553 in protocol.go

View workflow job for this annotation

GitHub Actions / lint (1.27)

Error return value of `p.bufReader.Discard` is not checked (errcheck)
n += int64(nn)
if err != nil {
return n, err
}

// Garbage collect the buffer.
p.bufReader = nil
}
{
nn, err := io.Copy(w, p.conn)
Expand Down
Loading