Skip to content

Commit

Permalink
move QUIC_GO_DISABLE_GSO check out of init (#4041)
Browse files Browse the repository at this point in the history
* move QUIC_GO_DISABLE_GSO test out of init().

* Update sys_conn_helper_linux.go

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
  • Loading branch information
jfgiorgi and marten-seemann committed Aug 23, 2023
1 parent 824fd8a commit 8d91ad9
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions sys_conn_helper_linux.go
Expand Up @@ -14,15 +14,6 @@ import (
"golang.org/x/sys/unix"
)

var gsoDisabled bool

func init() {
disabled, err := strconv.ParseBool(os.Getenv("QUIC_GO_DISABLE_GSO"))
if err == nil {
gsoDisabled = disabled
}
}

const (
msgTypeIPTOS = unix.IP_TOS
ipv4PKTINFO = unix.IP_PKTINFO
Expand Down Expand Up @@ -65,7 +56,8 @@ func parseIPv4PktInfo(body []byte) (ip netip.Addr, ifIndex uint32, ok bool) {
// isGSOSupported tests if the kernel supports GSO.
// Sending with GSO might still fail later on, if the interface doesn't support it (see isGSOError).
func isGSOSupported(conn syscall.RawConn) bool {
if gsoDisabled {
disabled, err := strconv.ParseBool(os.Getenv("QUIC_GO_DISABLE_GSO"))
if err == nil && disabled {
return false
}
var serr error
Expand Down

0 comments on commit 8d91ad9

Please sign in to comment.