From a23d734cd9bd05382d2bb8af46e0c9a7cbb1faa6 Mon Sep 17 00:00:00 2001 From: Cameron Dale Date: Sun, 24 Feb 2008 15:13:15 -0800 Subject: [PATCH] Ignore unknown cache files during directory scan. --- apt_dht/CacheManager.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/apt_dht/CacheManager.py b/apt_dht/CacheManager.py index 9bdf75b..ccd544b 100644 --- a/apt_dht/CacheManager.py +++ b/apt_dht/CacheManager.py @@ -187,12 +187,21 @@ class CacheManager: reactor.callLater(0, self._scanDirectories) return - # If it's not a file, or it's already properly in the DB, ignore it - if not file.isfile() or self.db.isUnchanged(file): - if not file.isfile(): - log.msg('entering directory: %s' % file.path) - else: - log.msg('file is unchanged: %s' % file.path) + # If it's not a file ignore it + if not file.isfile(): + log.msg('entering directory: %s' % file.path) + reactor.callLater(0, self._scanDirectories, None, walker) + return + + # If it's already properly in the DB, ignore it + if self.db.isUnchanged(file): + log.msg('file is unchanged: %s' % file.path) + reactor.callLater(0, self._scanDirectories, None, walker) + return + + # Don't hash files in the cache that are not in the DB + if self.scanning[0] == self.cache_dir: + log.msg('ignoring unknown cache file: %s' % file.path) reactor.callLater(0, self._scanDirectories, None, walker) return -- 2.39.5