mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-07-05 16:38:17 -04:00
set TCP keep alive only on TCP socket
This commit is contained in:
parent
1dfe55fac8
commit
c564c84b17
@ -47,12 +47,6 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.KeepAliveDuration != 0 {
|
|
||||||
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, int(config.KeepAliveDuration)); err != nil {
|
|
||||||
return newError("failed to set TCP_KEEPINTVL", err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if isTCPSocket(network) {
|
if isTCPSocket(network) {
|
||||||
switch config.Tfo {
|
switch config.Tfo {
|
||||||
case SocketConfig_Enable:
|
case SocketConfig_Enable:
|
||||||
@ -64,6 +58,12 @@ func applyOutboundSocketOptions(network string, address string, fd uintptr, conf
|
|||||||
return newError("failed to set TCP_FASTOPEN_CONNECT=0").Base(err)
|
return newError("failed to set TCP_FASTOPEN_CONNECT=0").Base(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if config.KeepAliveDuration != 0 {
|
||||||
|
if err := syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, syscall.TCP_KEEPINTVL, int(config.KeepAliveDuration)); err != nil {
|
||||||
|
return newError("failed to set TCP_KEEPINTVL", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.Tproxy.IsEnabled() {
|
if config.Tproxy.IsEnabled() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user