r238 - in /debtorrent/trunk: DebTorrent/ConfigDir.py DebTorrent/launchmanycore.py debtorrent-client.py
camrdale-guest at users.alioth.debian.org
camrdale-guest at users.alioth.debian.org
Tue Aug 14 19:18:16 UTC 2007
Author: camrdale-guest
Date: Tue Aug 14 19:18:16 2007
New Revision: 238
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=238
Log:
Fix a bug in deleting old cached data.
Modified:
debtorrent/trunk/DebTorrent/ConfigDir.py
debtorrent/trunk/DebTorrent/launchmanycore.py
debtorrent/trunk/debtorrent-client.py
Modified: debtorrent/trunk/DebTorrent/ConfigDir.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/ConfigDir.py?rev=238&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/ConfigDir.py (original)
+++ debtorrent/trunk/DebTorrent/ConfigDir.py Tue Aug 14 19:18:16 2007
@@ -674,7 +674,7 @@
names.setdefault(f,[]).append(p)
for k,v in times.items():
- if max(v) < exptime and not k in still_active:
+ if max(v) < exptime and not k in still_active and k in names:
for f in names[k]:
try:
os.remove(f)
Modified: debtorrent/trunk/DebTorrent/launchmanycore.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/launchmanycore.py?rev=238&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/launchmanycore.py (original)
+++ debtorrent/trunk/DebTorrent/launchmanycore.py Tue Aug 14 19:18:16 2007
@@ -377,7 +377,11 @@
seed(createPeerID())
# Restore the previous state of the downloads
- self.unpickle(self.configdir.getState())
+ still_running = self.unpickle(self.configdir.getState())
+
+ # Expire any old cached files
+ self.configdir.deleteOldCacheData(config['expire_cache_data'],
+ still_running, True)
self.handler.listen_forever()
@@ -771,14 +775,18 @@
@type data: C{dictionary}
@param data: the saved state of the previously running downloads downloads
+ @rtype: C{list} of C{string}
+ @return: the list of torrent hashes that are still running
"""
if data is None:
- return
-
+ return []
+
+ still_running = []
d = data['torrent cache']
for hash in d:
+ still_running.append(hash)
paused = d[hash].pop('paused', False)
metainfo = self.configdir.getTorrent(hash)
if metainfo:
@@ -786,3 +794,5 @@
self.add(hash, d[hash], False)
if paused:
self.downloads[hash].d.Pause()
+
+ return still_running
Modified: debtorrent/trunk/debtorrent-client.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/debtorrent-client.py?rev=238&op=diff
==============================================================================
--- debtorrent/trunk/debtorrent-client.py (original)
+++ debtorrent/trunk/debtorrent-client.py Tue Aug 14 19:18:16 2007
@@ -72,7 +72,6 @@
# Continue
if config['save_options']:
configdir.saveConfig(config)
- configdir.deleteOldCacheData(config['expire_cache_data'])
except ValueError, e:
logger.error('error: ' + str(e))
logger.error("Usage: debtorrent-client.py <global options>")
@@ -83,8 +82,13 @@
logger.exception('error: ' + str(e))
logging.shutdown()
exit(2)
+ except:
+ logger.exception('unhandled exception')
- LaunchMany(config, configdir)
+ try:
+ LaunchMany(config, configdir)
+ except:
+ logger.exception('unhandled exception')
logger.info('Shutting down')
logging.shutdown()
More information about the Debtorrent-commits
mailing list