Fix paused torrents not being paused upon restart

This commit is contained in:
Andrew Resch 2008-08-31 01:17:43 +00:00
parent c2a24bce8a
commit 0792ad21cd
2 changed files with 6 additions and 4 deletions

View File

@ -197,8 +197,9 @@ class Torrent:
def set_auto_managed(self, auto_managed):
self.options["auto_managed"] = auto_managed
self.handle.auto_managed(auto_managed)
self.update_state()
if not (self.handle.is_paused() and not self.handle.is_auto_managed()):
self.handle.auto_managed(auto_managed)
self.update_state()
def set_stop_ratio(self, stop_ratio):
self.options["stop_ratio"] = stop_ratio

View File

@ -327,6 +327,8 @@ class TorrentManager(component.Component):
return
log.debug("handle id: %s", str(handle.info_hash()))
# Set auto_managed to False because the torrent is paused
handle.auto_managed(False)
# Create a Torrent object
torrent = Torrent(handle, options, state, filename)
# Add the torrent object to the dictionary
@ -338,8 +340,7 @@ class TorrentManager(component.Component):
# Resume the torrent if needed
if not options["add_paused"]:
handle.resume()
handle.auto_managed(options["auto_managed"])
torrent.resume()
# Write the .torrent file to the state directory
if filedump: