]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/progress.go
MTH
[nncp.git] / src / progress.go
index 62e0f01b6ff77bc44e3bb18a64ebb2d5c17281df..0c2f0ee2c99f7cd874edd56fbded6e815bbdf8d2 100644 (file)
@@ -25,7 +25,7 @@ import (
        "time"
 
        "github.com/dustin/go-humanize"
-       "go.cypherpunks.ru/nncp/v5/uilive"
+       "go.cypherpunks.ru/nncp/v7/uilive"
 )
 
 func init() {
@@ -141,7 +141,7 @@ func Progress(prefix string, les LEs) {
                progressBarsLock.Unlock()
        }
        what := pkt
-       if len(what) >= 52 { // Base32 encoded
+       if len(what) >= Base32Encoded32Len { // Base32 encoded
                what = what[:16] + ".." + what[len(what)-16:]
        }
        what = prefix + " " + what
@@ -153,3 +153,13 @@ func Progress(prefix string, les LEs) {
                progressBarsLock.Unlock()
        }
 }
+
+func ProgressKill(pkt string) {
+       progressBarsLock.Lock()
+       pb, exists := progressBars[pkt]
+       if exists {
+               pb.Kill()
+               delete(progressBars, pkt)
+       }
+       progressBarsLock.Unlock()
+}