From 542970b961870017e91abc0156b9d2f431d57fcb Mon Sep 17 00:00:00 2001 From: YenForYang Date: Tue, 14 Sep 2021 19:14:28 -0500 Subject: [PATCH] Inlineable `(*Torrent).PieceState()` (#621) --- t.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t.go b/t.go index aae6812b..02d62979 100644 --- a/t.go +++ b/t.go @@ -74,10 +74,11 @@ func (t *Torrent) PieceStateRuns() (runs PieceStateRuns) { 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 -- 2.44.0