Skip to content

Commit

Permalink
do not output error log for connection closed
Browse files Browse the repository at this point in the history
  • Loading branch information
khushijain21 committed Oct 23, 2024
1 parent 0e8760f commit f6a0c7b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion transport/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ func LoggingDialer(d Dialer, logger *logp.Logger) Dialer {
func (l *loggingConn) Read(b []byte) (int, error) {
n, err := l.Conn.Read(b)
if err != nil && !errors.Is(err, io.EOF) {
l.logger.Debugf("Error reading from connection: %v", err)
// Check for a closed network connection error
if errors.Is(err, net.ErrClosed) {
l.logger.Debugf("Connection is closed: %v", err)
} else {
l.logger.Debugf("Error reading from connection: %v", err)
}
}
return n, err
}
Expand Down

0 comments on commit f6a0c7b

Please sign in to comment.