X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fprogress.go;h=ae0441041d63db31c687ea195ef0fce9da7dcc6b;hb=cf9363f956cb2d93a581c11ed65c5b02910d10d5;hp=945c57526419a2166cb20d3ea27057eff844da8b;hpb=fd1ff00305ba34a32a98f5ef0ad24e3dc8dfde1a;p=nncp.git diff --git a/src/progress.go b/src/progress.go index 945c575..ae04410 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/v6/uilive" + "go.cypherpunks.ru/nncp/v8/uilive" ) func init() { @@ -114,6 +114,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 } @@ -132,9 +144,9 @@ func Progress(prefix string, les LEs) { } } progressBarsLock.RLock() - pb, exists := progressBars[pkt] + pb := progressBars[pkt] progressBarsLock.RUnlock() - if !exists { + if pb == nil { progressBarsLock.Lock() pb = ProgressBarNew(size, fullsize) progressBars[pkt] = pb @@ -146,7 +158,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) @@ -156,8 +168,8 @@ func Progress(prefix string, les LEs) { func ProgressKill(pkt string) { progressBarsLock.Lock() - pb, exists := progressBars[pkt] - if exists { + pb := progressBars[pkt] + if pb != nil { pb.Kill() delete(progressBars, pkt) }