]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Reset the HTTPServer subdirectories when a new cache directory is created.
authorCameron Dale <camrdale@gmail.com>
Mon, 14 Jan 2008 06:58:46 +0000 (22:58 -0800)
committerCameron Dale <camrdale@gmail.com>
Mon, 14 Jan 2008 06:58:46 +0000 (22:58 -0800)
apt_dht/CacheManager.py
apt_dht/HTTPServer.py
apt_dht/apt_dht.py

index 36016198f08beb758930d7709f261c002a94b776..3789eae679cc4ee236fa6df885785e29805b9249 100644 (file)
@@ -206,6 +206,9 @@ class CacheManager:
                 
             urlpath, newdir = self.db.storeFile(destFile, hash.digest(), self.cache_dir)
             log.msg('now avaliable at %s: %s' % (urlpath, url))
+            if newdir and self.manager:
+                log.msg('A new web directory was created, so enable it')
+                self.manager.setDirectories(self.db.getAllDirectories())
 
             if self.manager:
                 self.manager.new_cached_file(url, destFile, hash, urlpath)
index 0e53c237ef175bdca4934bf335b05300ca8e337b..23f911d97b09553f64d1b2c557dbea18e208dded 100644 (file)
@@ -51,6 +51,7 @@ class TopLevel(resource.Resource):
             # Don't allow empty subdirectory
             if k:
                 self.subdirs[k] = dirs[k]
+        log.msg('new subdirectories initialized')
     
     def render(self, ctx):
         return http.Response(
index 3679685e5f70ad873b2076bad04f21265b6786e8..1abeaa5323ec0bf5b690ec2646bc309e7158387f 100644 (file)
@@ -35,6 +35,7 @@ class AptDHT:
         self.mirrors = MirrorManager(self.cache_dir)
         self.cache = CacheManager(self.cache_dir.child(download_dir), self.db, self)
         self.my_addr = None
+        self.setDirectories = self.http_server.setDirectories
     
     def getSite(self):
         return self.http_site