X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fprogress.go;h=c170674334a0fff1fc2e30b9f78d75a92f9ea146;hb=5fbec42464ddeefacd99f267c8b7bfe2fa2f428a;hp=5ebc72bdb20b2e16df5ba53ed33bf0669f5a13b5;hpb=d0d18ed65af3dd048272b04cc7f7f0007dd5dbd4;p=nncp.git diff --git a/src/progress.go b/src/progress.go index 5ebc72b..c170674 100644 --- a/src/progress.go +++ b/src/progress.go @@ -1,6 +1,6 @@ /* NNCP -- Node to Node copy, utilities for store-and-forward data exchange -Copyright (C) 2016-2021 Sergey Matveev +Copyright (C) 2016-2023 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ import ( "time" "github.com/dustin/go-humanize" - "go.cypherpunks.ru/nncp/v7/uilive" + "go.cypherpunks.ru/nncp/v8/uilive" ) func init() { @@ -37,7 +37,6 @@ var progressBarsLock sync.RWMutex type ProgressBar struct { w *uilive.Writer - hash string started time.Time initial int64 full int64 @@ -114,6 +113,18 @@ func CopyProgressed( break } } + if showPrgrs { + for _, le := range les { + if le.K == "FullSize" { + if le.V.(int64) == 0 { + Progress(prgrsPrefix, append( + les, LE{"Size", written}, LE{"FullSize", written}, + )) + } + break + } + } + } return } @@ -146,7 +157,7 @@ func Progress(prefix string, les LEs) { } what = prefix + " " + what pb.Render(what, size) - if size >= fullsize { + if fullsize != 0 && size >= fullsize { pb.Kill() progressBarsLock.Lock() delete(progressBars, pkt)