mirror of
https://github.com/minio/minio.git
synced 2024-12-25 06:35:56 -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"
|
||||
)
|
||||
|
||||
func setTCPParameters(c syscall.RawConn) error {
|
||||
func setInternalTCPParameters(c syscall.RawConn) error {
|
||||
return c.Control(func(fdPtr uintptr) {
|
||||
// got socket file descriptor to set parameters.
|
||||
fd := int(fdPtr)
|
||||
@ -67,7 +67,7 @@ func NewCustomDialContext(dialTimeout time.Duration) DialContext {
|
||||
dialer := &net.Dialer{
|
||||
Timeout: dialTimeout,
|
||||
Control: func(network, address string, c syscall.RawConn) error {
|
||||
return setTCPParameters(c)
|
||||
return setInternalTCPParameters(c)
|
||||
},
|
||||
}
|
||||
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
|
||||
func setTCPParameters(c syscall.RawConn) error {
|
||||
func setInternalTCPParameters(c syscall.RawConn) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -81,10 +81,7 @@ func (listener *httpListener) start() {
|
||||
|
||||
// Closure to handle single connection.
|
||||
handleConn := func(tcpConn *net.TCPConn, doneCh <-chan struct{}) {
|
||||
rawConn, err := tcpConn.SyscallConn()
|
||||
if err == nil {
|
||||
setTCPParameters(rawConn)
|
||||
}
|
||||
tcpConn.SetKeepAlive(true)
|
||||
send(acceptResult{tcpConn, nil}, doneCh)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user