]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Export Torrent.PieceState()
authorMatt Joiner <anacrolix@gmail.com>
Sun, 7 Feb 2016 10:57:57 +0000 (21:57 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Sun, 7 Feb 2016 10:57:57 +0000 (21:57 +1100)
t.go

diff --git a/t.go b/t.go
index 6bb1071109c2326df8c36d3ce23110ed76ff76c6..23e00c002def6a12c97224a4056a99c01bdf11b9 100644 (file)
--- a/t.go
+++ b/t.go
@@ -53,6 +53,12 @@ func (t Torrent) PieceStateRuns() []PieceStateRun {
        return t.torrent.pieceStateRuns()
 }
 
+func (t Torrent) PieceState(piece int) PieceState {
+       t.torrent.stateMu.Lock()
+       defer t.torrent.stateMu.Unlock()
+       return t.torrent.pieceState(piece)
+}
+
 // The number of pieces in the torrent. This requires that the info has been
 // obtained first.
 func (t Torrent) NumPieces() int {