]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Add TorrentStats.PiecesComplete
authorMatt Joiner <anacrolix@gmail.com>
Thu, 7 Oct 2021 02:50:13 +0000 (13:50 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Thu, 7 Oct 2021 02:50:13 +0000 (13:50 +1100)
Fixes https://github.com/anacrolix/torrent/issues/352.

torrent.go
torrent_stats.go

index 5693ef1c698cc842174193009e890e3cc22e2d6d..3c6a65d9ab627cc87ae171c8114d7ea424c01743 100644 (file)
@@ -1760,6 +1760,7 @@ func (t *Torrent) statsLocked() (ret TorrentStats) {
                }
        }
        ret.ConnStats = t.stats.Copy()
+       ret.PiecesComplete = t.numPiecesCompleted()
        return
 }
 
index bc54e1bd2768e22ce24e0851036bf5075f630396..0dd58add90ad1b21066ef6daaf93d2f72282b92a 100644 (file)
@@ -13,4 +13,5 @@ type TorrentStats struct {
        ActivePeers      int
        ConnectedSeeders int
        HalfOpenPeers    int
+       PiecesComplete   int
 }