Skip to content

Commit

Permalink
Revert "Merge pull request samalba#202 from dongluochen/supportTcpUse…
Browse files Browse the repository at this point in the history
…rTimeout"

This reverts commit d72aea4, reversing
changes made to 73c9581.
  • Loading branch information
rubenv committed Jan 13, 2016
1 parent d72aea4 commit 6204918
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 68 deletions.
16 changes: 1 addition & 15 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,7 @@ func newHTTPClient(u *url.URL, tlsConfig *tls.Config, timeout time.Duration) *ht
switch u.Scheme {
default:
httpTransport.Dial = func(proto, addr string) (net.Conn, error) {
conn, err := net.DialTimeout(proto, addr, timeout)
if tcpConn, ok := conn.(*net.TCPConn); ok {
// Set TCP user timeout. Sender breaks TCP connection
// if packets are not acknowledged after 20 seconds. This is a
// relatively new TCP option to improve dead peer detection.
// Do not fail newHTTPClient if OS doesn's support it.

// user timeout shouldn't be too aggressive
userTimeout := timeout
if userTimeout < 20*time.Second {
userTimeout = 20 * time.Second
}
SetTCPUserTimeout(tcpConn, userTimeout)
}
return conn, err
return net.DialTimeout(proto, addr, timeout)
}
case "unix":
socketPath := u.Path
Expand Down
25 changes: 0 additions & 25 deletions utils_unix.go

This file was deleted.

28 changes: 0 additions & 28 deletions utils_windows.go

This file was deleted.

0 comments on commit 6204918

Please sign in to comment.