Skip to content

Commit

Permalink
Remove noisy printf in NextReader()
Browse files Browse the repository at this point in the history
  • Loading branch information
Brendan Creane authored and AlexVulaj committed Dec 11, 2023
1 parent 01b0aae commit dcea2f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
5 changes: 1 addition & 4 deletions compression.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"compress/flate"
"errors"
"io"
"log"
"strings"
"sync"
)
Expand Down Expand Up @@ -135,9 +134,7 @@ func (r *flateReadWrapper) Read(p []byte) (int, error) {
// Preemptively place the reader back in the pool. This helps with
// scenarios where the application does not call NextReader() soon after
// this final read.
if err := r.Close(); err != nil {
log.Printf("websocket: flateReadWrapper.Close() returned error: %v", err)
}
_ = r.Close()
}
return n, err
}
Expand Down
9 changes: 2 additions & 7 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"encoding/binary"
"errors"
"io"
"log"
"net"
"strconv"
"strings"
Expand Down Expand Up @@ -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
// change this without breaking existing applications.
if c.writer != nil {
if err := c.writer.Close(); err != nil {
log.Printf("websocket: discarding writer close error: %v", err)
}
_ = c.writer.Close()
c.writer = nil
}

Expand Down Expand Up @@ -1021,9 +1018,7 @@ func (c *Conn) handleProtocolError(message string) error {
func (c *Conn) NextReader() (messageType int, r io.Reader, err error) {
// Close previous reader, only relevant for decompression.
if c.reader != nil {
if err := c.reader.Close(); err != nil {
log.Printf("websocket: discarding reader close error: %v", err)
}
_ = c.reader.Close()
c.reader = nil
}

Expand Down

0 comments on commit dcea2f0

Please sign in to comment.