]> git.mxchange.org Git - quix0rs-apt-p2p.git/blobdiff - apt_dht/PeerManager.py
Add some of the fetching logic.
[quix0rs-apt-p2p.git] / apt_dht / PeerManager.py
index e372f694d432a3d8d63713d156defb419b098358..6a3b77dd4e56df366941dcf2f4c5e6bd6d1944a3 100644 (file)
@@ -11,22 +11,22 @@ class PeerManager:
     def __init__(self):
         self.clients = {}
         
-    def get(self, location_list, method="GET"):
+    def get(self, location_list, method="GET", modtime=None):
         """Download from a list of peers.
         
         @type location_list: C{list} of (C{string}, C{int}, C{string})
         @var location_list: a list of the locations where the file can be found
         """
         host, port, path = choice(location_list)
-        return self.getPeer(host, port, path, method)
+        return self.getPeer(host, port, path, method, modtime)
         
-    def getPeer(self, host, port, path, method="GET"):
+    def getPeer(self, host, port, path, method="GET", modtime=None):
         if not port:
             port = 80
         site = host + ":" + str(port)
         if site not in self.clients:
             self.clients[site] = HTTPClientManager(host, port)
-        return self.clients[site].get(path, method)
+        return self.clients[site].get(path, method, modtime)
     
     def close(self):
         for site in self.clients: