Fix paused torrents not being paused upon restart

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

View file

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

View file

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