]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Include incomplete torrent count in client status
authorMatt Joiner <anacrolix@gmail.com>
Thu, 24 Apr 2025 13:03:50 +0000 (23:03 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 24 Apr 2025 13:08:39 +0000 (23:08 +1000)
client.go

index 1d618f9716da41c0a66952fa37bf54225f4d3196..f1d29d0636caf9894ccecea61512b46b4444453d 100644 (file)
--- a/client.go
+++ b/client.go
@@ -160,7 +160,13 @@ func (cl *Client) WriteStatus(_w io.Writer) {
        })
        dumpStats(w, cl.statsLocked())
        torrentsSlice := cl.torrentsAsSlice()
-       fmt.Fprintf(w, "# Torrents: %d\n", len(torrentsSlice))
+       incomplete := 0
+       for _, t := range torrentsSlice {
+               if !t.Complete().Bool() {
+                       incomplete++
+               }
+       }
+       fmt.Fprintf(w, "# Torrents: %d (%v incomplete)\n", len(torrentsSlice), incomplete)
        fmt.Fprintln(w)
        sort.Slice(torrentsSlice, func(l, r int) bool {
                return torrentsSlice[l].canonicalShortInfohash().AsString() < torrentsSlice[r].canonicalShortInfohash().AsString()