]> git.mxchange.org Git - quix0rs-apt-p2p.git/blobdiff - apt_dht/MirrorManager.py
Copied the more advanced bencode module from DebTorrent.
[quix0rs-apt-p2p.git] / apt_dht / MirrorManager.py
index 70138e69e22ed6823f64e8d9ffa53651f28f2993..c41dbe23c8439bda7314794046564c7a1a28940d 100644 (file)
@@ -208,6 +208,10 @@ class MirrorManager:
     
     def save_file(self, response, hash, url):
         """Save a downloaded file to the cache and stream it."""
+        if response.code != 200:
+            log.msg('File was not found (%r): %s' % (response, url))
+            return response
+        
         log.msg('Returning file: %s' % url)
         
         parsed = urlparse(url)
@@ -259,7 +263,7 @@ class MirrorManager:
                 self.updatedFile(url[:-len(ext)], decFile.path)
             
             if self.manager:
-                self.manager.download_complete(hash, url, destFile.path)
+                self.manager.cached_file(hash, url, destFile.path)
         else:
             log.msg("Hashes don't match %s != %s: %s" % (hash.hexexpected(), hash.hexdigest(), url))