Make sure prioritize first/last doesn't enable pieces in

a file marked do not download. refs #2211
This commit is contained in:
Chase Sterling 2013-04-29 18:07:04 -04:00
commit 289730a3e3

View file

@ -318,12 +318,10 @@ class Torrent(object):
prioritized_pieces.append((first_start, first_end)) prioritized_pieces.append((first_start, first_end))
prioritized_pieces.append((last_start, last_end)) prioritized_pieces.append((last_start, last_end))
# Creating two lists with priorites for the first/last pieces # Set the pieces in our first and last ranges to priority 7
# of this file, and insert the priorities into the list # if they are not marked as do not download
first_list = [7] * (first_end - first_start) priorities[first_start:first_end] = map(lambda p: p and 7, priorities[first_start:first_end])
last_list = [7] * (last_end - last_start) priorities[last_start:last_end] = map(lambda p: p and 7, priorities[last_start:last_end])
priorities[first_start:first_end] = first_list
priorities[last_start:last_end] = last_list
# Setting the priorites for all the pieces of this torrent # Setting the priorites for all the pieces of this torrent
self.handle.prioritize_pieces(priorities) self.handle.prioritize_pieces(priorities)
return prioritized_pieces, priorities return prioritized_pieces, priorities