mirror of
https://github.com/rclone/rclone
synced 2024-12-25 17:03:45 +01:00
vendor: update github.com/ncw/swift to fix memory leak in swift transfers
This commit is contained in:
parent
115053930e
commit
567071750b
6
Gopkg.lock
generated
6
Gopkg.lock
generated
@ -136,7 +136,7 @@
|
||||
branch = "master"
|
||||
name = "github.com/ncw/swift"
|
||||
packages = ["."]
|
||||
revision = "9d3f812e23d270d1c66a9a01e20af1005061cdc4"
|
||||
revision = "c95c6e5c2d1a3d37fc44c8c6dc9e231c7500667d"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
@ -157,10 +157,10 @@
|
||||
revision = "2b3a18b5f0fb6b4f9190549597d3f962c02bc5eb"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
name = "github.com/pkg/sftp"
|
||||
packages = ["."]
|
||||
revision = "98203f5a8333288eb3163b7c667d4260fe1333e9"
|
||||
version = "1.0.0"
|
||||
revision = "7c1f7a370726a2457b33b29baefc2402b4965c65"
|
||||
|
||||
[[projects]]
|
||||
name = "github.com/pmezard/go-difflib"
|
||||
|
9
vendor/github.com/ncw/swift/largeobjects.go
generated
vendored
9
vendor/github.com/ncw/swift/largeobjects.go
generated
vendored
@ -276,8 +276,9 @@ func (file *largeObjectCreateFile) Size() int64 {
|
||||
}
|
||||
|
||||
func withLORetry(expectedSize int64, fn func() (Headers, int64, error)) (err error) {
|
||||
endTimer := time.NewTimer(readAfterWriteTimeout)
|
||||
defer endTimer.Stop()
|
||||
waitingTime := readAfterWriteWait
|
||||
endTimer := time.After(readAfterWriteTimeout)
|
||||
for {
|
||||
var headers Headers
|
||||
var sz int64
|
||||
@ -288,11 +289,13 @@ func withLORetry(expectedSize int64, fn func() (Headers, int64, error)) (err err
|
||||
} else {
|
||||
return
|
||||
}
|
||||
waitTimer := time.NewTimer(waitingTime)
|
||||
select {
|
||||
case <-endTimer:
|
||||
case <-endTimer.C:
|
||||
waitTimer.Stop()
|
||||
err = fmt.Errorf("Timeout expired while waiting for object to have size == %d, got: %d", expectedSize, sz)
|
||||
return
|
||||
case <-time.After(waitingTime):
|
||||
case <-waitTimer.C:
|
||||
waitingTime *= 2
|
||||
}
|
||||
}
|
||||
|
2
vendor/github.com/ncw/swift/swift.go
generated
vendored
2
vendor/github.com/ncw/swift/swift.go
generated
vendored
@ -471,6 +471,7 @@ again:
|
||||
}
|
||||
if req != nil {
|
||||
timer := time.NewTimer(c.ConnectTimeout)
|
||||
defer timer.Stop()
|
||||
var resp *http.Response
|
||||
resp, err = c.doTimeoutRequest(timer, req)
|
||||
if err != nil {
|
||||
@ -691,6 +692,7 @@ func (c *Connection) Call(targetUrl string, p RequestOpts) (resp *http.Response,
|
||||
URL.RawQuery = p.Parameters.Encode()
|
||||
}
|
||||
timer := time.NewTimer(c.ConnectTimeout)
|
||||
defer timer.Stop()
|
||||
reader := p.Body
|
||||
if reader != nil {
|
||||
reader = newWatchdogReader(reader, c.Timeout, timer)
|
||||
|
4
vendor/github.com/ncw/swift/timeout_reader.go
generated
vendored
4
vendor/github.com/ncw/swift/timeout_reader.go
generated
vendored
@ -38,10 +38,12 @@ func (t *timeoutReader) Read(p []byte) (int, error) {
|
||||
done <- result{n, err}
|
||||
}()
|
||||
// Wait for the read or the timeout
|
||||
timer := time.NewTimer(t.timeout)
|
||||
defer timer.Stop()
|
||||
select {
|
||||
case r := <-done:
|
||||
return r.n, r.err
|
||||
case <-time.After(t.timeout):
|
||||
case <-timer.C:
|
||||
t.cancel()
|
||||
return 0, TimeoutError
|
||||
}
|
||||
|
2
vendor/github.com/pkg/sftp/sftp.go
generated
vendored
2
vendor/github.com/pkg/sftp/sftp.go
generated
vendored
@ -1,5 +1,5 @@
|
||||
// Package sftp implements the SSH File Transfer Protocol as described in
|
||||
// https://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
|
||||
// https://tools.ietf.org/html/draft-ietf-secsh-filexfer-02
|
||||
package sftp
|
||||
|
||||
import (
|
||||
|
Loading…
Reference in New Issue
Block a user