Make Torrent.cancelRequestsForPiece more efficient
This commit is contained in:
parent
506ff8d037
commit
80aec73cb5
|
@ -1995,9 +1995,8 @@ func (t *Torrent) pieceHashed(piece pieceIndex, passed bool, hashIoErr error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Torrent) cancelRequestsForPiece(piece pieceIndex) {
|
func (t *Torrent) cancelRequestsForPiece(piece pieceIndex) {
|
||||||
// TODO: Make faster
|
for ri := t.pieceRequestIndexOffset(piece); ri < t.pieceRequestIndexOffset(piece+1); ri++ {
|
||||||
for cn := range t.conns {
|
t.cancelRequest(ri)
|
||||||
cn.tickleWriter()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue