From: YenForYang Date: Wed, 15 Sep 2021 00:13:46 +0000 (-0500) Subject: Inlineable `DownloadPieces()` and `CancelPieces()` (#623) X-Git-Tag: v1.32.0~58 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=a0fe0a087da524e3c5e345fe657a98c4a7127414;p=btrtrc.git Inlineable `DownloadPieces()` and `CancelPieces()` (#623) --- diff --git a/t.go b/t.go index b42a3f0f..3f65d48b 100644 --- a/t.go +++ b/t.go @@ -180,8 +180,8 @@ func (t *Torrent) deleteReader(r *reader) { // has been obtained, see Torrent.Info and Torrent.GotInfo. func (t *Torrent) DownloadPieces(begin, end pieceIndex) { t.cl.lock() - defer t.cl.unlock() t.downloadPiecesLocked(begin, end) + t.cl.unlock() } func (t *Torrent) downloadPiecesLocked(begin, end pieceIndex) { @@ -194,8 +194,8 @@ func (t *Torrent) downloadPiecesLocked(begin, end pieceIndex) { func (t *Torrent) CancelPieces(begin, end pieceIndex) { t.cl.lock() - defer t.cl.unlock() t.cancelPiecesLocked(begin, end) + t.cl.unlock() } func (t *Torrent) cancelPiecesLocked(begin, end pieceIndex) {