more speedlimiter persistence fixes/tweaks

This commit is contained in:
Marcos Pinto 2007-08-28 23:38:58 +00:00
commit ee9a01ab6d

View file

@ -79,15 +79,18 @@ class DesiredSpeed:
unique_ID = self.core.get_torrent_unique_id(torrent) unique_ID = self.core.get_torrent_unique_id(torrent)
try: try:
if self.core.unique_IDs[unique_ID].upload_rate_limit != -1: if self.core.unique_IDs[unique_ID].upload_rate_limit != -1:
self.core.set_per_upload_rate_limit(unique_ID, value = self.core.unique_IDs[unique_ID].upload_rate_limit / 1024
self.core.unique_IDs[unique_ID].upload_rate_limit) self.core.set_per_upload_rate_limit(unique_ID, value)
self.set_up_speeds[unique_ID] = \ self.set_up_speeds[unique_ID] = value
self.core.unique_IDs[unique_ID].upload_rate_limit / 1024 if value not in self.config.get("up_speeds") and value >= 1:
self.config.get("up_speeds").insert(0, value)
self.config.get("up_speeds").pop()
if self.core.unique_IDs[unique_ID].download_rate_limit != -1: if self.core.unique_IDs[unique_ID].download_rate_limit != -1:
self.core.set_per_download_rate_limit(unique_ID, self.core.set_per_download_rate_limit(unique_ID, value)
self.core.unique_IDs[unique_ID].download_rate_limit) self.set_down_speeds[unique_ID] = value
self.set_down_speeds[unique_ID] = \ if value not in self.config.get("down_speeds") and value >= 1:
self.core.unique_IDs[unique_ID].download_rate_limit / 1024 self.config.get("down_speeds").insert(0, value)
self.config.get("down_speeds").pop()
except AttributeError: except AttributeError:
pass pass