summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2010-10-10 12:34:13 -0700
committerAndrew Resch <andrewresch@gmail.com>2010-10-10 12:34:13 -0700
commit60fac28217ed709be2883670157d13fcdf485122 (patch)
treebacf2f10a45bf7063ce675465cb58893284db889
parent59e01e7ecfca089b759b22f00eb2abc1693b4fcc (diff)
downloaddeluge-60fac28217ed709be2883670157d13fcdf485122.tar.gz
deluge-60fac28217ed709be2883670157d13fcdf485122.tar.bz2
deluge-60fac28217ed709be2883670157d13fcdf485122.zip
Keep a torrent paused after a forced recheck if it was paused to start.
-rw-r--r--deluge/core/torrent.py8
-rw-r--r--deluge/core/torrentmanager.py9
2 files changed, 16 insertions, 1 deletions
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index 2423635e7..50a05b237 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -179,6 +179,11 @@ class Torrent(object):
else:
self.time_added = time.time()
+ # Keep track if we're forcing a recheck of the torrent so that we can
+ # repause it after its done if necessary
+ self.forcing_recheck = False
+ self.forcing_recheck_paused = False
+
log.debug("Torrent object created.")
## Options methods ##
@@ -859,12 +864,15 @@ class Torrent(object):
def force_recheck(self):
"""Forces a recheck of the torrents pieces"""
+ paused = self.handle.is_paused()
try:
self.handle.force_recheck()
self.handle.resume()
except Exception, e:
log.debug("Unable to force recheck: %s", e)
return False
+ self.forcing_recheck = True
+ self.forcing_recheck_paused = paused
return True
def rename_files(self, filenames):
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index 5e137c6fd..4ce881c22 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -849,7 +849,14 @@ class TorrentManager(component.Component):
torrent = self.torrents[str(alert.handle.info_hash())]
except:
return
-
+
+ # Check to see if we're forcing a recheck and set it back to paused
+ # if necessary
+ if torrent.forcing_recheck:
+ torrent.forcing_recheck = False
+ if torrent.forcing_recheck_paused:
+ torrent.handle.pause()
+
# Set the torrent state
torrent.update_state()