package net
import (
)
func ( *netFD, time.Duration) error {
if == 0 {
= defaultTCPKeepAliveIdle
} else if < 0 {
return nil
}
:= int(roundDurationUp(, time.Second))
:= .pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPIDLE, )
runtime.KeepAlive()
return wrapSyscallError("setsockopt", )
}
func ( *netFD, time.Duration) error {
if == 0 {
= defaultTCPKeepAliveInterval
} else if < 0 {
return nil
}
:= int(roundDurationUp(, time.Second))
:= .pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, )
runtime.KeepAlive()
return wrapSyscallError("setsockopt", )
}
func ( *netFD, int) error {
if == 0 {
= defaultTCPKeepAliveCount
} else if < 0 {
return nil
}
:= .pfd.SetsockoptInt(syscall.IPPROTO_TCP, syscall.TCP_KEEPCNT, )
runtime.KeepAlive()
return wrapSyscallError("setsockopt", )
}