From 89d5c48d280ad14f7c7001686f9e0630353d8feb Mon Sep 17 00:00:00 2001 From: Joshua Kissoon Date: Thu, 8 May 2014 22:28:22 +0530 Subject: [PATCH] Bucket Refresh Operation - Just found a major Bug!!! We were doing 160 refreshes looking for nodes with the local nodeId as the lookup ID for all 160 refreshes - Updated to check for nodes at different distances from the local NodeId Content Lookup Operation - We were still using KademliaNode instead of KademliaNode.getNode to use the mini node for comparisons --- src/kademlia/message/StoreContentMessage.java | 1 - src/kademlia/operation/BucketRefreshOperation.java | 2 +- src/kademlia/operation/ContentRefreshOperation.java | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/kademlia/message/StoreContentMessage.java b/src/kademlia/message/StoreContentMessage.java index 9a7ce5d..edd8075 100644 --- a/src/kademlia/message/StoreContentMessage.java +++ b/src/kademlia/message/StoreContentMessage.java @@ -3,7 +3,6 @@ package kademlia.message; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; -import kademlia.dht.KadContent; import kademlia.dht.StorageEntry; import kademlia.node.Node; import kademlia.util.serializer.JsonSerializer; diff --git a/src/kademlia/operation/BucketRefreshOperation.java b/src/kademlia/operation/BucketRefreshOperation.java index 3282a7c..2dcf97e 100644 --- a/src/kademlia/operation/BucketRefreshOperation.java +++ b/src/kademlia/operation/BucketRefreshOperation.java @@ -53,7 +53,7 @@ public class BucketRefreshOperation implements Operation { try { - new NodeLookupOperation(server, localNode, localNode.getNode().getNodeId(), BucketRefreshOperation.this.config).execute(); + new NodeLookupOperation(server, localNode, current, BucketRefreshOperation.this.config).execute(); } catch (IOException e) { diff --git a/src/kademlia/operation/ContentRefreshOperation.java b/src/kademlia/operation/ContentRefreshOperation.java index 8fac0d8..2ad54c9 100644 --- a/src/kademlia/operation/ContentRefreshOperation.java +++ b/src/kademlia/operation/ContentRefreshOperation.java @@ -73,7 +73,7 @@ public class ContentRefreshOperation implements Operation for (Node n : closestNodes) { /*We don't need to again store the content locally, it's already here*/ - if (!n.equals(this.localNode)) + if (!n.equals(this.localNode.getNode())) { /* Send a contentstore operation to the K-Closest nodes */ this.server.sendMessage(n, msg, null); @@ -83,7 +83,7 @@ public class ContentRefreshOperation implements Operation /* Delete any content on this node that this node is not one of the K-Closest nodes to */ try { - if (!closestNodes.contains(this.localNode)) + if (!closestNodes.contains(this.localNode.getNode())) { this.dht.remove(e); }