From 72a06d88fce77659348e296b55e589cfce47f061 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 7 Oct 2021 13:50:13 +1100 Subject: [PATCH] Add TorrentStats.PiecesComplete Fixes https://github.com/anacrolix/torrent/issues/352. --- torrent.go | 1 + torrent_stats.go | 1 + 2 files changed, 2 insertions(+) diff --git a/torrent.go b/torrent.go index 5693ef1c..3c6a65d9 100644 --- a/torrent.go +++ b/torrent.go @@ -1760,6 +1760,7 @@ func (t *Torrent) statsLocked() (ret TorrentStats) { } } ret.ConnStats = t.stats.Copy() + ret.PiecesComplete = t.numPiecesCompleted() return } diff --git a/torrent_stats.go b/torrent_stats.go index bc54e1bd..0dd58add 100644 --- a/torrent_stats.go +++ b/torrent_stats.go @@ -13,4 +13,5 @@ type TorrentStats struct { ActivePeers int ConnectedSeeders int HalfOpenPeers int + PiecesComplete int }