Massive work on the peer downloading, not working or complete yet.
[quix0rs-apt-p2p.git] / apt_p2p / apt_p2p.py
index 4a97d4c2a6c1ecd05619fbb969b6ea5ffa97fd7a..0063e9fffd2ebb08373be003c346c4d90c950d63 100644 (file)
@@ -70,16 +70,17 @@ class AptP2P:
         """
         log.msg('Initializing the main apt_p2p application')
         self.dhtClass = dhtClass
-        self.cache_dir = FilePath(config.get('DEFAULT', 'cache_dir'))
+        self.cache_dir = FilePath(config.get('DEFAULT', 'CACHE_DIR'))
         if not self.cache_dir.child(download_dir).exists():
             self.cache_dir.child(download_dir).makedirs()
         self.db = DB(self.cache_dir.child('apt-p2p.db'))
         self.dht = dhtClass()
         self.dht.loadConfig(config, config.get('DEFAULT', 'DHT'))
         self.dht.join().addCallbacks(self.joinComplete, self.joinError)
-        self.http_server = TopLevel(self.cache_dir.child(download_dir), self.db, self)
+        self.http_server = TopLevel(self.cache_dir.child(download_dir), self.db, self,
+                                    config.getint('DEFAULT', 'UPLOAD_LIMIT'))
         self.getHTTPFactory = self.http_server.getHTTPFactory
-        self.peers = PeerManager()
+        self.peers = PeerManager(self.cache_dir, self.dht)
         self.mirrors = MirrorManager(self.cache_dir, config.gettime('DEFAULT', 'UNLOAD_PACKAGES_CACHE'))
         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)