Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions intra/core/sockopt.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,17 @@
}

func DisableKeepAlive(c MinConn) bool {
if tc, ok := c.(*net.TCPConn); ok {
tc.SetKeepAlive(false)
if sc, ok := c.(syscall.Conn); ok {
raw, err := sc.SyscallConn()
if err != nil {
return false
}
err = raw.Control(func(fd uintptr) {

Check failure on line 74 in intra/core/sockopt.go

View workflow job for this annotation

GitHub Actions / 🧬 Build

error: Potential nil panic detected. Observed nil flow from source to dereference point:
syscall.SetsockoptInt(int(fd), syscall.SOL_SOCKET, syscall.SO_KEEPALIVE, 0)

Check failure on line 75 in intra/core/sockopt.go

View workflow job for this annotation

GitHub Actions / 🧭 Lint

Error return value of `syscall.SetsockoptInt` is not checked (errcheck)

Check warning

Code scanning / gosec

Errors unhandled Warning

Errors unhandled
})
if err != nil {

Check failure on line 77 in intra/core/sockopt.go

View workflow job for this annotation

GitHub Actions / 🧭 Lint

should use 'return err == nil' instead of 'if err != nil { return false }; return true' (S1008)

Check failure on line 77 in intra/core/sockopt.go

View workflow job for this annotation

GitHub Actions / 🧭 Lint

S1008: should use 'return err == nil' instead of 'if err != nil { return false }; return true' (gosimple)
return false
}
return true
}
return false
Expand Down
Loading