2
0
mirror of synced 2025-02-23 14:18:13 +00:00

Export Torrent.PieceState()

This commit is contained in:
Matt Joiner 2016-02-07 21:57:57 +11:00
parent 096c870029
commit 54b538d322

6
t.go
View File

@ -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 {