Skip to content

Commit

Permalink
refactor: silence connection buffer size override errors
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Stewart <christian@aperture.us>
  • Loading branch information
paralin committed Jul 1, 2024
1 parent 7bb1a67 commit d5349ee
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
40 changes: 20 additions & 20 deletions sys_conn.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package quic

import (
"log"
"net"
"os"
"strconv"
"strings"
"syscall"
"time"

Expand All @@ -28,24 +24,28 @@ var _ OOBCapablePacketConn = &net.UDPConn{}

func wrapConn(pc net.PacketConn) (rawConn, error) {
if err := setReceiveBuffer(pc); err != nil {

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)

Check failure on line 26 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)
if !strings.Contains(err.Error(), "use of closed network connection") {
setBufferWarningOnce.Do(func() {
if disable, _ := strconv.ParseBool(os.Getenv("QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING")); disable {
return
}
log.Printf("%s. See /~https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.", err)
})
}
/*
if !strings.Contains(err.Error(), "use of closed network connection") {
setBufferWarningOnce.Do(func() {
if disable, _ := strconv.ParseBool(os.Getenv("QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING")); disable {
return
}
log.Printf("%s. See /~https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.", err)
})
}
*/
}
if err := setSendBuffer(pc); err != nil {

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.21.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)

Check failure on line 38 in sys_conn.go

View workflow job for this annotation

GitHub Actions / golangci-lint (Go 1.22.x)

SA9003: empty branch (staticcheck)
if !strings.Contains(err.Error(), "use of closed network connection") {
setBufferWarningOnce.Do(func() {
if disable, _ := strconv.ParseBool(os.Getenv("QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING")); disable {
return
}
log.Printf("%s. See /~https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.", err)
})
}
/*
if !strings.Contains(err.Error(), "use of closed network connection") {
setBufferWarningOnce.Do(func() {
if disable, _ := strconv.ParseBool(os.Getenv("QUIC_GO_DISABLE_RECEIVE_BUFFER_WARNING")); disable {
return
}
log.Printf("%s. See /~https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details.", err)
})
}
*/
}

conn, ok := pc.(interface {
Expand Down
3 changes: 0 additions & 3 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,6 @@ func (t *Transport) close(e error) {
t.closed = true
}

// only print warnings about the UDP receive buffer size once
var setBufferWarningOnce sync.Once

func (t *Transport) listen(conn rawConn) {
defer close(t.listening)

Expand Down

0 comments on commit d5349ee

Please sign in to comment.