mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-17 12:33:01 +00:00
Fix sockopt.TcpKeepAliveInterval
The Keep-Alive configs may be overridden with golang default settings when `tcpKeepAliveInterval` is set without `tcpKeepAliveIdle`.
This commit is contained in:
parent
c7f7e07821
commit
8e75e9d763
@ -70,7 +70,7 @@ func (d *DefaultSystemDialer) Dial(ctx context.Context, src net.Address, dest ne
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
goStdKeepAlive := time.Duration(0)
|
goStdKeepAlive := time.Duration(0)
|
||||||
if sockopt != nil && sockopt.TcpKeepAliveIdle != 0 {
|
if sockopt != nil && (sockopt.TcpKeepAliveInterval != 0 || sockopt.TcpKeepAliveIdle != 0) {
|
||||||
goStdKeepAlive = time.Duration(-1)
|
goStdKeepAlive = time.Duration(-1)
|
||||||
}
|
}
|
||||||
dialer := &net.Dialer{
|
dialer := &net.Dialer{
|
||||||
|
@ -51,7 +51,7 @@ func (dl *DefaultListener) Listen(ctx context.Context, addr net.Addr, sockopt *S
|
|||||||
network = addr.Network()
|
network = addr.Network()
|
||||||
address = addr.String()
|
address = addr.String()
|
||||||
lc.Control = getControlFunc(ctx, sockopt, dl.controllers)
|
lc.Control = getControlFunc(ctx, sockopt, dl.controllers)
|
||||||
if sockopt != nil && sockopt.TcpKeepAliveIdle != 0 {
|
if sockopt != nil && (sockopt.TcpKeepAliveInterval != 0 || sockopt.TcpKeepAliveIdle != 0) {
|
||||||
lc.KeepAlive = time.Duration(-1)
|
lc.KeepAlive = time.Duration(-1)
|
||||||
}
|
}
|
||||||
case *net.UnixAddr:
|
case *net.UnixAddr:
|
||||||
|
Loading…
Reference in New Issue
Block a user