mirror of
https://github.com/minio/minio.git
synced 2024-12-25 14:45:54 -05:00
add different TCP timeouts for internal and incoming (#10090)
closes #10086
This commit is contained in:
parent
7764c542f2
commit
e2c71717f8
@ -27,7 +27,7 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
func setTCPParameters(c syscall.RawConn) error {
|
func setInternalTCPParameters(c syscall.RawConn) error {
|
||||||
return c.Control(func(fdPtr uintptr) {
|
return c.Control(func(fdPtr uintptr) {
|
||||||
// got socket file descriptor to set parameters.
|
// got socket file descriptor to set parameters.
|
||||||
fd := int(fdPtr)
|
fd := int(fdPtr)
|
||||||
@ -67,7 +67,7 @@ func NewCustomDialContext(dialTimeout time.Duration) DialContext {
|
|||||||
dialer := &net.Dialer{
|
dialer := &net.Dialer{
|
||||||
Timeout: dialTimeout,
|
Timeout: dialTimeout,
|
||||||
Control: func(network, address string, c syscall.RawConn) error {
|
Control: func(network, address string, c syscall.RawConn) error {
|
||||||
return setTCPParameters(c)
|
return setInternalTCPParameters(c)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return dialer.DialContext(ctx, network, addr)
|
return dialer.DialContext(ctx, network, addr)
|
||||||
|
@ -26,7 +26,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// TODO: if possible implement for non-linux platforms, not a priority at the moment
|
// TODO: if possible implement for non-linux platforms, not a priority at the moment
|
||||||
func setTCPParameters(c syscall.RawConn) error {
|
func setInternalTCPParameters(c syscall.RawConn) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,10 +81,7 @@ func (listener *httpListener) start() {
|
|||||||
|
|
||||||
// Closure to handle single connection.
|
// Closure to handle single connection.
|
||||||
handleConn := func(tcpConn *net.TCPConn, doneCh <-chan struct{}) {
|
handleConn := func(tcpConn *net.TCPConn, doneCh <-chan struct{}) {
|
||||||
rawConn, err := tcpConn.SyscallConn()
|
tcpConn.SetKeepAlive(true)
|
||||||
if err == nil {
|
|
||||||
setTCPParameters(rawConn)
|
|
||||||
}
|
|
||||||
send(acceptResult{tcpConn, nil}, doneCh)
|
send(acceptResult{tcpConn, nil}, doneCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user