Re-apply per-torrent settings after forced recheck.

This commit is contained in:
Andrew Resch 2008-04-13 01:25:33 +00:00
parent 4b620896a5
commit 49af682226
2 changed files with 17 additions and 4 deletions

View File

@ -110,6 +110,9 @@ class Torrent:
self.files = self.get_files()
# Set the default file priorities to normal
self.file_priorities = [1]* len(self.files)
# Set resolve_countries to True
self.handle.resolve_countries(True)
log.debug("Torrent object created.")
@ -344,6 +347,16 @@ class Torrent:
status_dict[key] = fns[key]()
return status_dict
def apply_options(self):
"""Applies the per-torrent options that are set."""
self.handle.set_max_connections(self.max_connections)
self.handle.set_max_uploads(self.max_upload_slots)
self.handle.set_upload_limit(int(self.max_upload_speed * 1024))
self.handle.set_download_limit(int(self.max_download_speed * 1024))
self.handle.get_torrent_info().set_priv(self.private)
self.handle.prioritize_files(self.file_priorities)
self.handle.resolve_countries(True)
def pause(self):
"""Pause this torrent"""

View File

@ -285,10 +285,7 @@ class TorrentManager(component.Component):
self.queue.insert(0, torrent.torrent_id)
else:
self.queue.insert(queue, torrent.torrent_id)
# Set resolve_countries to True
handle.resolve_countries(True)
# Set per-torrent options
torrent.set_max_connections(options["max_connections_per_torrent"])
torrent.set_max_upload_slots(options["max_upload_slots_per_torrent"])
@ -455,6 +452,9 @@ class TorrentManager(component.Component):
# The torrent was not added to the session
return False
# Set all the per-torrent options
torrent.apply_options()
# Set the state to Checking
torrent.set_state("Checking")