Remove noisy printf in NextReader()

This commit is contained in:
Brendan Creane 2023-11-29 13:16:16 -08:00 committed by Alex Vulaj
parent 01b0aaed92
commit dcea2f088c
2 changed files with 3 additions and 11 deletions

View File

@ -8,7 +8,6 @@ import (
"compress/flate" "compress/flate"
"errors" "errors"
"io" "io"
"log"
"strings" "strings"
"sync" "sync"
) )
@ -135,9 +134,7 @@ func (r *flateReadWrapper) Read(p []byte) (int, error) {
// Preemptively place the reader back in the pool. This helps with // Preemptively place the reader back in the pool. This helps with
// scenarios where the application does not call NextReader() soon after // scenarios where the application does not call NextReader() soon after
// this final read. // this final read.
if err := r.Close(); err != nil { _ = r.Close()
log.Printf("websocket: flateReadWrapper.Close() returned error: %v", err)
}
} }
return n, err return n, err
} }

View File

@ -10,7 +10,6 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"io" "io"
"log"
"net" "net"
"strconv" "strconv"
"strings" "strings"
@ -490,9 +489,7 @@ func (c *Conn) beginMessage(mw *messageWriter, messageType int) error {
// probably better to return an error in this situation, but we cannot // probably better to return an error in this situation, but we cannot
// change this without breaking existing applications. // change this without breaking existing applications.
if c.writer != nil { if c.writer != nil {
if err := c.writer.Close(); err != nil { _ = c.writer.Close()
log.Printf("websocket: discarding writer close error: %v", err)
}
c.writer = nil c.writer = nil
} }
@ -1021,9 +1018,7 @@ func (c *Conn) handleProtocolError(message string) error {
func (c *Conn) NextReader() (messageType int, r io.Reader, err error) { func (c *Conn) NextReader() (messageType int, r io.Reader, err error) {
// Close previous reader, only relevant for decompression. // Close previous reader, only relevant for decompression.
if c.reader != nil { if c.reader != nil {
if err := c.reader.Close(); err != nil { _ = c.reader.Close()
log.Printf("websocket: discarding reader close error: %v", err)
}
c.reader = nil c.reader = nil
} }