Make Torrent.cancelRequestsForPiece more efficient

This commit is contained in:
Matt Joiner 2021-12-18 09:22:18 +11:00
parent 506ff8d037
commit 80aec73cb5
1 changed files with 2 additions and 3 deletions

View File

@ -1995,9 +1995,8 @@ func (t *Torrent) pieceHashed(piece pieceIndex, passed bool, hashIoErr error) {
}
func (t *Torrent) cancelRequestsForPiece(piece pieceIndex) {
// TODO: Make faster
for cn := range t.conns {
cn.tickleWriter()
for ri := t.pieceRequestIndexOffset(piece); ri < t.pieceRequestIndexOffset(piece+1); ri++ {
t.cancelRequest(ri)
}
}