From 366ead7d658dd4bd925badbedcd096edfed56249 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 8 Jan 2019 15:46:03 +1100 Subject: [PATCH] Switch to Client read locks for a few methods --- t.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t.go b/t.go index 04326206..8af13dc2 100644 --- a/t.go +++ b/t.go @@ -45,14 +45,14 @@ func (t *Torrent) NewReader() Reader { // 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) } -- 2.48.1