diff --git a/bar.go b/bar.go index 3d31501..2db7c3d 100644 --- a/bar.go +++ b/bar.go @@ -212,7 +212,11 @@ func (b *Bar) SetTotal(total int64, complete bool) { select { case b.operateState <- func(s *bState) { - s.total = total + if total <= 0 { + s.total = s.current + } else { + s.total = total + } if complete && !s.toComplete { s.current = s.total s.toComplete = true diff --git a/proxyreader.go b/proxyreader.go index 1034fe6..7361424 100644 --- a/proxyreader.go +++ b/proxyreader.go @@ -19,7 +19,7 @@ } if err == io.EOF { go func() { - prox.bar.SetTotal(prox.bar.Current(), true) + prox.bar.SetTotal(0, true) }() } return @@ -38,7 +38,7 @@ } if err == io.EOF { go func() { - prox.bar.SetTotal(prox.bar.Current(), true) + prox.bar.SetTotal(0, true) }() } return