forked from distribution/distribution
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add TCPUserTimeout param to s3 driver
customizes `TCP_USER_TIMEOUT` value for S3 client connections.
- Loading branch information
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//go:build !linux | ||
// +build !linux | ||
|
||
package s3 | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
func setTCPUserTimeout(fd uintptr, timeout time.Duration) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package s3 | ||
|
||
import ( | ||
"syscall" | ||
"time" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
func setTCPUserTimeout(fd uintptr, timeout time.Duration) error { | ||
return syscall.SetsockoptInt(int(fd), syscall.IPPROTO_TCP, unix.TCP_USER_TIMEOUT, int(timeout.Milliseconds())) | ||
} |