vendor: update github.com/ncw/swift to fix memory leak in swift transfers

This commit is contained in:
Nick Craig-Wood 2017-10-19 14:44:13 +01:00
parent 115053930e
commit 567071750b
5 changed files with 15 additions and 8 deletions

View file

@ -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
}