From: Matt Joiner Date: Sun, 7 Feb 2016 10:57:57 +0000 (+1100) Subject: Export Torrent.PieceState() X-Git-Tag: v1.0.0~905 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=54b538d3222578d7691f6222b4c5b1b4da93484c;p=btrtrc.git Export Torrent.PieceState() --- diff --git a/t.go b/t.go index 6bb10711..23e00c00 100644 --- 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 {