Skip to content

Commit

Permalink
don't print a receive buffer warning for closed connections (#3346)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Mar 16, 2022
1 parent ad1cb27 commit 580cc75
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packet_handler_map.go
Expand Up @@ -11,6 +11,7 @@ import (
"net"
"os"
"strconv"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -123,12 +124,14 @@ func newPacketHandlerMap(
logger utils.Logger,
) (packetHandlerManager, error) {
if err := setReceiveBuffer(c, logger); err != nil {
receiveBufferWarningOnce.Do(func() {
if disable, _ := strconv.ParseBool(os.Getenv("QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING")); disable {
return
}
log.Printf("%s. See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.", err)
})
if !strings.Contains(err.Error(), "use of closed network connection") {
receiveBufferWarningOnce.Do(func() {
if disable, _ := strconv.ParseBool(os.Getenv("QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING")); disable {
return
}
log.Printf("%s. See https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size for details.", err)
})
}
}
conn, err := wrapConn(c)
if err != nil {
Expand Down

0 comments on commit 580cc75

Please sign in to comment.