t.go | 7 ++++--- diff --git a/t.go b/t.go index aae6812baf24a056f0527ca557555f141a123a8d..02d629794a333642568a8f96130ebcd032e17cba 100644 --- a/t.go +++ b/t.go @@ -74,10 +74,11 @@ t.cl.rUnlock() return } -func (t *Torrent) PieceState(piece pieceIndex) PieceState { +func (t *Torrent) PieceState(piece pieceIndex) (ps PieceState) { t.cl.rLock() - defer t.cl.rUnlock() - return t.pieceState(piece) + ps = t.pieceState(piece) + t.cl.rUnlock() + return } // The number of pieces in the torrent. This requires that the info has been