From: Cameron Dale Date: Sun, 24 Feb 2008 23:13:15 +0000 (-0800) Subject: Ignore unknown cache files during directory scan. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a23d734cd9bd05382d2bb8af46e0c9a7cbb1faa6;p=quix0rs-apt-p2p.git Ignore unknown cache files during directory scan. --- 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