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
This commit is contained in:
Joshua Kissoon 2014-05-08 22:28:22 +05:30
parent 98fc727cbe
commit 89d5c48d28
3 changed files with 3 additions and 4 deletions

View File

@ -3,7 +3,6 @@ package kademlia.message;
import java.io.DataInputStream; import java.io.DataInputStream;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
import kademlia.dht.KadContent;
import kademlia.dht.StorageEntry; import kademlia.dht.StorageEntry;
import kademlia.node.Node; import kademlia.node.Node;
import kademlia.util.serializer.JsonSerializer; import kademlia.util.serializer.JsonSerializer;

View File

@ -53,7 +53,7 @@ public class BucketRefreshOperation implements Operation
{ {
try try
{ {
new NodeLookupOperation(server, localNode, localNode.getNode().getNodeId(), BucketRefreshOperation.this.config).execute(); new NodeLookupOperation(server, localNode, current, BucketRefreshOperation.this.config).execute();
} }
catch (IOException e) catch (IOException e)
{ {

View File

@ -73,7 +73,7 @@ public class ContentRefreshOperation implements Operation
for (Node n : closestNodes) for (Node n : closestNodes)
{ {
/*We don't need to again store the content locally, it's already here*/ /*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 */ /* Send a contentstore operation to the K-Closest nodes */
this.server.sendMessage(n, msg, null); 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 */ /* Delete any content on this node that this node is not one of the K-Closest nodes to */
try try
{ {
if (!closestNodes.contains(this.localNode)) if (!closestNodes.contains(this.localNode.getNode()))
{ {
this.dht.remove(e); this.dht.remove(e);
} }