Fixed justSeenNode in KTable to update the bucket properly.
[quix0rs-apt-p2p.git] / apt_p2p_Khashmir / ktable.py
index 3e60f5c..864dfe5 100644 (file)
@@ -226,6 +226,12 @@ class KTable:
             n = self.buckets[i].l[it]
             tstamp = n.lastSeen
             n.updateLastSeen()
             n = self.buckets[i].l[it]
             tstamp = n.lastSeen
             n.updateLastSeen()
+            
+            # Move the node to the end and touch the bucket
+            del(self.buckets[i].l[it])
+            self.buckets[i].l.append(n)
+            self.buckets[i].touch()
+            
             return tstamp
     
     def invalidateNode(self, n):
             return tstamp
     
     def invalidateNode(self, n):