t.go | 8 ++++---- diff --git a/t.go b/t.go index 043262066fe8a73b4d30e8f7c2a2ed14b065ab1a..8af13dc2a16b5773782946635ecb7c473b4a2a82 100644 --- a/t.go +++ b/t.go @@ -45,14 +45,14 @@ // Returns the state of pieces of the torrent. They are grouped into runs of // same state. The sum of the state run lengths is the number of pieces // in the torrent. func (t *Torrent) PieceStateRuns() []PieceStateRun { - t.cl.lock() - defer t.cl.unlock() + t.cl.rLock() + defer t.cl.rUnlock() return t.pieceStateRuns() } func (t *Torrent) PieceState(piece pieceIndex) PieceState { - t.cl.lock() - defer t.cl.unlock() + t.cl.rLock() + defer t.cl.rUnlock() return t.pieceState(piece) }