Skip to content

Commit

Permalink
udpmux: Don't log an error if canceled because of shutdown (#2903)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo authored Aug 2, 2024
1 parent 5ec5964 commit 1482ef6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion p2p/transport/webrtc/udpmux/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package udpmux
import (
"bytes"
"context"
"errors"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -143,7 +144,7 @@ func (mux *UDPMux) readLoop() {

n, addr, err := mux.socket.ReadFrom(buf)
if err != nil {
if strings.Contains(err.Error(), "use of closed network connection") {
if strings.Contains(err.Error(), "use of closed network connection") || errors.Is(err, context.Canceled) {
log.Debugf("readLoop exiting: socket %s closed", mux.socket.LocalAddr())
} else {
log.Errorf("error reading from socket %s: %v", mux.socket.LocalAddr(), err)
Expand Down

0 comments on commit 1482ef6

Please sign in to comment.