2
0
mirror of synced 2025-02-23 14:18:13 +00:00

Inlineable DownloadPieces() and CancelPieces() (#623)

This commit is contained in:
YenForYang 2021-09-14 19:13:46 -05:00 committed by GitHub
parent 29638d9e5d
commit a0fe0a087d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
t.go
View File

@ -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) {