]> git.mxchange.org Git - quix0rs-apt-p2p.git/blobdiff - apt_dht/apt_dht.py
Supply a modified factory with increased pipelining and timeouts.
[quix0rs-apt-p2p.git] / apt_dht / apt_dht.py
index 047d1c2b815dbf7c3d3643244c5f04fa9b8d0fad..aeda56bf2147930d2a9c03c57f38bd3296f64863 100644 (file)
@@ -31,18 +31,17 @@ class AptDHT:
         self.dht.join().addCallbacks(self.joinComplete, self.joinError)
         self.http_server = TopLevel(self.cache_dir.child(download_dir), self)
         self.setDirectories = self.http_server.setDirectories
-        self.http_site = server.Site(self.http_server)
+        self.getHTTPFactory = self.http_server.getHTTPFactory
         self.peers = PeerManager()
         self.mirrors = MirrorManager(self.cache_dir)
         other_dirs = [FilePath(f) for f in config.getstringlist('DEFAULT', 'OTHER_DIRS')]
         self.cache = CacheManager(self.cache_dir.child(download_dir), self.db, other_dirs, self)
         self.my_addr = None
     
-    def getSite(self):
-        return self.http_site
-    
     def joinComplete(self, result):
-        self.my_addr = findMyIPAddr(result, config.getint(config.get('DEFAULT', 'DHT'), 'PORT'))
+        self.my_addr = findMyIPAddr(result,
+                                    config.getint(config.get('DEFAULT', 'DHT'), 'PORT'),
+                                    config.getboolean('DEFAULT', 'LOCAL_OK'))
         if not self.my_addr:
             raise RuntimeError, "IP address for this machine could not be found"
         self.cache.scanDirectories()