forked from quic-go/quic-go
perform send / receive buffer increases when setting up the connection (#3949)
The UDP send and receive buffer is now increased when calling OptimizeConn.
This commit is contained in:
25
sys_conn.go
25
sys_conn.go
@@ -2,7 +2,11 @@ package quic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -44,6 +48,27 @@ func wrapConn(pc net.PacketConn) (interface {
|
||||
rawConn
|
||||
}, error,
|
||||
) {
|
||||
if err := setReceiveBuffer(pc); err != nil {
|
||||
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 {
|
||||
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 {
|
||||
SyscallConn() (syscall.RawConn, error)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user