|
|
@@ -25,6 +25,11 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|
|
if err := setTFO(syscall.Handle(fd), config.Tfo); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
+ if config.TcpKeepAliveInterval > 0 {
|
|
|
+ if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.SOL_SOCKET, syscall.SO_KEEPALIVE, 1); err != nil {
|
|
|
+ return newError("failed to set SO_KEEPALIVE", err)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return nil
|
|
|
@@ -35,6 +40,11 @@ func applyInboundSocketOptions(network string, fd uintptr, config *SocketConfig)
|
|
|
if err := setTFO(syscall.Handle(fd), config.Tfo); err != nil {
|
|
|
return err
|
|
|
}
|
|
|
+ if config.TcpKeepAliveInterval > 0 {
|
|
|
+ if err := syscall.SetsockoptInt(syscall.Handle(fd), syscall.SOL_SOCKET, syscall.SO_KEEPALIVE, 1); err != nil {
|
|
|
+ return newError("failed to set SO_KEEPALIVE", err)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return nil
|