X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=apt_dht_Khashmir%2Fktable.py;h=907263edd9664c005860501d33390261c6b6bb34;hb=30b935bcd7c698e2be8ac4a20960e48212ad7249;hp=6dc5fd6e9e85eb4d7519df21848354adb4031ddc;hpb=e6beef78406c3093fc4eb98c4293b9257b44aa61;p=quix0rs-apt-p2p.git diff --git a/apt_dht_Khashmir/ktable.py b/apt_dht_Khashmir/ktable.py index 6dc5fd6..907263e 100644 --- a/apt_dht_Khashmir/ktable.py +++ b/apt_dht_Khashmir/ktable.py @@ -4,6 +4,7 @@ from datetime import datetime from bisect import bisect_left +from twisted.python import log from twisted.trial import unittest import khash @@ -133,7 +134,7 @@ class KTable: # this bucket is full and contains our node, split the bucket if len(self.buckets) >= self.config['HASH_LENGTH']: # our table is FULL, this is really unlikely - print "Hash Table is FULL! Increase K!" + log.err("Hash Table is FULL! Increase K!") return self._splitBucket(self.buckets[i]) @@ -210,11 +211,11 @@ class KBucket: class TestKTable(unittest.TestCase): def setUp(self): - self.a = Node(khash.newID(), 'localhost', 2002) + self.a = Node(khash.newID(), '127.0.0.1', 2002) self.t = KTable(self.a, {'HASH_LENGTH': 160, 'K': 8, 'MAX_FAILURES': 3}) def testAddNode(self): - self.b = Node(khash.newID(), 'localhost', 2003) + self.b = Node(khash.newID(), '127.0.0.1', 2003) self.t.insertNode(self.b) self.failUnlessEqual(len(self.t.buckets[0].l), 1) self.failUnlessEqual(self.t.buckets[0].l[0], self.b)