]> git.mxchange.org Git - quix0rs-apt-p2p.git/blobdiff - apt_dht/apt_dht.py
Move the normalization of key lengths from the HashObject to the DHT.
[quix0rs-apt-p2p.git] / apt_dht / apt_dht.py
index 94260bd4c396a4c216e2952c9094ae2a1cdaf0cb..9fa79cdcbbbb1cc9611d14f84ae18a1e768f599b 100644 (file)
@@ -152,7 +152,7 @@ class AptDHT:
 
     def lookupHash(self, hash, path, d):
         log.msg('Looking up hash in DHT for file: %s' % path)
-        key = hash.normexpected(bits = config.getint(config.get('DEFAULT', 'DHT'), 'HASH_LENGTH'))
+        key = hash.expected()
         lookupDefer = self.dht.getValue(key)
         lookupDefer.addCallback(self.lookupHash_done, hash, path, d)
 
@@ -195,7 +195,7 @@ class AptDHT:
             
     def store(self, hash):
         """Add a file to the DHT."""
-        key = hash.norm(bits = config.getint(config.get('DEFAULT', 'DHT'), 'HASH_LENGTH'))
+        key = hash.digest()
         value = {'c': self.my_contact}
         pieces = hash.pieceDigests()
         if len(pieces) <= 1: