Skip to content

intra/ipn: turn off TCP keepalive by default #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: n2
Choose a base branch
from

Conversation

Lanius-collaris
Copy link
Contributor

Closes #144

@@ -497,5 +497,9 @@ func maybeKeepAlive(c net.Conn) {
if settings.GetDialerOpts().LowerKeepAlive {
// adjust TCP keepalive config if c is a TCPConn
core.SetKeepAliveConfigSockOpt(c)
} else {
if tcpConn, ok := c.(*net.TCPConn); ok {
Copy link
Contributor

@ignoramous ignoramous Apr 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

This change could be made in rwext instead and a call to core.SetKeepAliveConfSockOpt be removed from all other places (like auto.go)?

rwext will also have to set the kacfg for DialerOpts.LowerKeepAlive now.

func (rw rwext) SetAsTCPSockOpt() (c *net.TCPConn, ok bool) {
r, w := rw.deadlines()
timeout := max(int(r), int(w))
c, ok = rw.Conn.(*net.TCPConn) // no-op for tcp conns
if ok && r > 0 {
// always returns false for udp conns
ok = core.SetTimeoutSockOpt(c, timeout*1000)
}
return c, ok
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unset TCP Keepalive
2 participants