]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Inlineable `(*Torrent).PieceState()` (#621)
authorYenForYang <YenForYang@users.noreply.github.com>
Wed, 15 Sep 2021 00:14:28 +0000 (19:14 -0500)
committerGitHub <noreply@github.com>
Wed, 15 Sep 2021 00:14:28 +0000 (10:14 +1000)
t.go

diff --git a/t.go b/t.go
index aae6812baf24a056f0527ca557555f141a123a8d..02d629794a333642568a8f96130ebcd032e17cba 100644 (file)
--- 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