update github.com/ncw/swift package in vendor to avoid potential memory leaks

Signed-off-by: mlmhl <409107750@qq.com>
This commit is contained in:
mlmhl 2017-12-04 11:31:10 +08:00 committed by Corey Quon
parent 9930542dc5
commit 5a74b806f0
No known key found for this signature in database
GPG key ID: 9B8614CDFD2E86EC
10 changed files with 1387 additions and 162 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
}