From fc9bb503df05944097902e589271495fc92640c7 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 18 Mar 2008 01:41:09 +0000 Subject: [PATCH] Attempt to fix issue where core will no longer pause/resume torrents. --- deluge/core/torrent.py | 8 ++++---- deluge/core/torrentmanager.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index cf1732230..7a5231475 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -151,11 +151,11 @@ class Torrent: log.debug("Trying to set an invalid state %s", state) return - if state == "Queued" and not self.handle.is_paused(): - component.get("TorrentManager").append_not_state_paused(self.torrent_id) - self.handle.pause() - if state != self.state: + if state == "Queued" and not self.handle.is_paused(): + component.get("TorrentManager").append_not_state_paused(self.torrent_id) + self.handle.pause() + self.state = state # Update the torrentqueue on any state changes diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 43f55a1cc..f38a6ec2c 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -168,7 +168,8 @@ class TorrentManager(component.Component): """Appends to a list of torrents that we will not set state Paused to when we receive the paused alert from libtorrent. The torrents are removed from this list once we receive the alert they have been paused in libtorrent.""" - self.not_state_paused.append(torrent_id) + if torrent_id not in self.not_state_paused: + self.not_state_paused.append(torrent_id) def add(self, filename, filedump=None, options=None, total_uploaded=0, trackers=None, queue=-1, state=None, save_state=True):