forked from TrueCloudLab/rclone
fs/fshttp: fix --contimeout being ignored
The following command will block for 60s(default) when the network is slow or unavailable: ``` rclone --contimeout 10s --low-level-retries 0 lsd dropbox: ``` This change will make it timeout after the expected 10s. Signed-off-by: rkonfj <rkonfj@gmail.com>
This commit is contained in:
parent
4eed3ae99a
commit
fd2322cb41
2 changed files with 2 additions and 6 deletions
|
@ -14,10 +14,6 @@ import (
|
||||||
"golang.org/x/net/ipv6"
|
"golang.org/x/net/ipv6"
|
||||||
)
|
)
|
||||||
|
|
||||||
func dialContext(ctx context.Context, network, address string, ci *fs.ConfigInfo) (net.Conn, error) {
|
|
||||||
return NewDialer(ctx).DialContext(ctx, network, address)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Dialer structure contains default dialer and timeout, tclass support
|
// Dialer structure contains default dialer and timeout, tclass support
|
||||||
type Dialer struct {
|
type Dialer struct {
|
||||||
net.Dialer
|
net.Dialer
|
||||||
|
|
|
@ -91,8 +91,8 @@ func NewTransportCustom(ctx context.Context, customize func(*http.Transport)) ht
|
||||||
}
|
}
|
||||||
|
|
||||||
t.DisableCompression = ci.NoGzip
|
t.DisableCompression = ci.NoGzip
|
||||||
t.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
|
t.DialContext = func(reqCtx context.Context, network, addr string) (net.Conn, error) {
|
||||||
return dialContext(ctx, network, addr, ci)
|
return NewDialer(ctx).DialContext(reqCtx, network, addr)
|
||||||
}
|
}
|
||||||
t.IdleConnTimeout = 60 * time.Second
|
t.IdleConnTimeout = 60 * time.Second
|
||||||
t.ExpectContinueTimeout = ci.ExpectContinueTimeout
|
t.ExpectContinueTimeout = ci.ExpectContinueTimeout
|
||||||
|
|
Loading…
Reference in a new issue