]> git.mxchange.org Git - quix0rs-apt-p2p.git/commitdiff
Merge branch 'documentation' into apt-dht
authorCameron Dale <camrdale@gmail.com>
Wed, 5 Mar 2008 23:06:44 +0000 (15:06 -0800)
committerCameron Dale <camrdale@gmail.com>
Wed, 5 Mar 2008 23:06:44 +0000 (15:06 -0800)
TODO
apt_dht/AptPackages.py
apt_dht/MirrorManager.py
apt_dht/db.py

diff --git a/TODO b/TODO
index b4951933a627a2d6a5b4d47e4f561401aaa4e188..192670b54e3de79b2d0775c61e470c13ea13da79 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,3 +1,15 @@
+Evaluate and fix some errors in the ktable khashmir module.
+
+The KTable implementation has some possible errors in it. insertNode
+does not remove the original and use the new node when updating a node
+already in the table, as claimed by the comments. justSeenNode doesn't
+verify that the found node is the node that was being looked for, nor
+does it move the node to the end of the list of nodes (since they are
+supposed to be sorted by their lastSeen time) or update the bucket's
+last touched time.nodeFailed also doesn't verify the found node is the
+right node.
+
+
 Consider what happens when we are the closest node.
 
 In some of the actions it is unclear what happens when we are one of the
@@ -47,3 +59,20 @@ originally provided the piece is probably at fault, since he is now
 providing a later piece. This doesn't work if the differing piece is the 
 first piece, in which case it is downloaded from a 3rd peer, with 
 consensus revealing the misbehaving peer.
+
+
+Consider adding peer characteristics to the DHT.
+
+Bad peers could be indicated in the DHT by adding a new value that is
+the NOT of their ID (so they are guaranteed not to store it) indicating
+information about the peer. This could be bad votes on the peer, as
+otherwise a peer could add good info about itself.
+
+
+Consider adding pieces to the DHT instead of files.
+
+Instead of adding file hashes to the DHT, only piece hashes could be
+added. This would allow a peer to upload to other peers while it is
+still downloading the rest of the file. It is not clear that this is
+needed, since peer's will not be uploading and downloading ery much of
+the time.
index 45c035f12833ce707f933d34c2c2978421e9e8f9..c784b8b68bf7386139caccd8f814a2318ba2c13a 100644 (file)
@@ -209,7 +209,6 @@ class AptPackages:
         
     def __del__(self):
         self.cleanup()
-        self.packages.close()
         
     def addRelease(self, cache_path, file_path):
         """Add a Release file's info to the list of index files.
@@ -341,6 +340,8 @@ class AptPackages:
     def cleanup(self):
         """Cleanup and close any loaded caches."""
         self.unload()
+        if self.unload_later and self.unload_later.active():
+            self.unload_later.cancel()
         self.packages.close()
         
     def findHash(self, path):
index 79f577ba6d8dc3e4cf8dbcafb5b978245c09b84b..bccb2e53ff4bd3bec7fd6f83415163eb2308c13d 100644 (file)
@@ -118,6 +118,13 @@ class MirrorManager:
         d.errback(MirrorError("Site Not Found"))
         return d
     
+    def cleanup(self):
+        for site in self.apt_caches.keys():
+            for baseDir in self.apt_caches[site].keys():
+                self.apt_caches[site][baseDir].cleanup()
+                del self.apt_caches[site][baseDir]
+            del self.apt_caches[site]
+    
 class TestMirrorManager(unittest.TestCase):
     """Unit tests for the mirror manager."""
     
@@ -233,5 +240,6 @@ class TestMirrorManager(unittest.TestCase):
         for p in self.pending_calls:
             if p.active():
                 p.cancel()
+        self.client.cleanup()
         self.client = None
         
\ No newline at end of file
index f72b104d8c5965950ad744a432af86d3431e103d..fd265f6f36503ca31cf9d8a0dda11b8c78bc9f89 100644 (file)
@@ -128,7 +128,7 @@ class DB:
         else:
             # Add the new hash to the database
             c = self.conn.cursor()
-            c.execute("INSERT OR REPLACE INTO hashes (hash, pieces, piecehash, refreshed) VALUES (?, ?, ?)",
+            c.execute("INSERT OR REPLACE INTO hashes (hash, pieces, piecehash, refreshed) VALUES (?, ?, ?, ?)",
                       (khash(hash), khash(pieces), khash(piecehash), datetime.now()))
             self.conn.commit()
             new_hash = True