aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/vbauerster/mpb/v7/proxyreader.go
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-12-07 17:20:47 +0100
committerValentin Rothberg <rothberg@redhat.com>2021-12-07 17:20:47 +0100
commitd87a9b788b3ae273421ee1a6960689ceb2e4f256 (patch)
tree697f88388ead6282f655b6c25adc91e6e4f0121a /vendor/github.com/vbauerster/mpb/v7/proxyreader.go
parent23ce826a84db81b834ef62584b6d3ffb3e0084fd (diff)
downloadpodman-d87a9b788b3ae273421ee1a6960689ceb2e4f256.tar.gz
podman-d87a9b788b3ae273421ee1a6960689ceb2e4f256.tar.bz2
podman-d87a9b788b3ae273421ee1a6960689ceb2e4f256.zip
vendor c/image/v5@main
Mainly to pull in fixes for #11636 which handles credential helpers correctly. Fixes: #11636 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'vendor/github.com/vbauerster/mpb/v7/proxyreader.go')
-rw-r--r--vendor/github.com/vbauerster/mpb/v7/proxyreader.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/vendor/github.com/vbauerster/mpb/v7/proxyreader.go b/vendor/github.com/vbauerster/mpb/v7/proxyreader.go
index 316f438d7..2f20053bd 100644
--- a/vendor/github.com/vbauerster/mpb/v7/proxyreader.go
+++ b/vendor/github.com/vbauerster/mpb/v7/proxyreader.go
@@ -38,14 +38,13 @@ func (x *proxyWriterTo) WriteTo(w io.Writer) (int64, error) {
type ewmaProxyReader struct {
io.ReadCloser // *proxyReader
bar *Bar
- iT time.Time
}
func (x *ewmaProxyReader) Read(p []byte) (int, error) {
+ start := time.Now()
n, err := x.ReadCloser.Read(p)
if n > 0 {
- x.bar.DecoratorEwmaUpdate(time.Since(x.iT))
- x.iT = time.Now()
+ x.bar.DecoratorEwmaUpdate(time.Since(start))
}
return n, err
}
@@ -54,14 +53,13 @@ type ewmaProxyWriterTo struct {
io.ReadCloser // *ewmaProxyReader
wt io.WriterTo // *proxyWriterTo
bar *Bar
- iT time.Time
}
func (x *ewmaProxyWriterTo) WriteTo(w io.Writer) (int64, error) {
+ start := time.Now()
n, err := x.wt.WriteTo(w)
if n > 0 {
- x.bar.DecoratorEwmaUpdate(time.Since(x.iT))
- x.iT = time.Now()
+ x.bar.DecoratorEwmaUpdate(time.Since(start))
}
return n, err
}
@@ -71,10 +69,9 @@ func newProxyReader(r io.Reader, bar *Bar) io.ReadCloser {
rc = &proxyReader{rc, bar}
if wt, isWriterTo := r.(io.WriterTo); bar.hasEwmaDecorators {
- now := time.Now()
- rc = &ewmaProxyReader{rc, bar, now}
+ rc = &ewmaProxyReader{rc, bar}
if isWriterTo {
- rc = &ewmaProxyWriterTo{rc, wt, bar, now}
+ rc = &ewmaProxyWriterTo{rc, wt, bar}
}
} else if isWriterTo {
rc = &proxyWriterTo{rc, wt, bar}