Fixed the bug that was causing the problem when adding the local node to the routing table when the routing table is created.

- The problem was that we were creating the RoutingTable before the Node initialization was finished, which was causing some problems since the RoutingTable needs the NodeId which is not available until after the Node initialization
This commit is contained in:
Joshua Kissoon 2014-03-22 12:41:46 +05:30
parent 3f82c4a0ef
commit 104f20775f
2 changed files with 3 additions and 7 deletions

View File

@ -26,17 +26,13 @@ public class Node implements Streamable
private transient RoutingTable routingTable; private transient RoutingTable routingTable;
{
this.routingTable = new RoutingTable(this);
}
public Node(NodeId nid, InetAddress ip, int port) public Node(NodeId nid, InetAddress ip, int port)
{ {
this.nodeId = nid; this.nodeId = nid;
this.inetAddress = ip; this.inetAddress = ip;
this.port = port; this.port = port;
this.strRep = this.nodeId.toString(); this.strRep = this.nodeId.toString();
this.routingTable = new RoutingTable(this);
} }
/** /**

View File

@ -32,8 +32,8 @@ public class RoutingTable
/* Initialize all of the buckets to a specific depth */ /* Initialize all of the buckets to a specific depth */
this.initialize(); this.initialize();
/* @todo Insert the local node */ /* Insert the local node */
//this.insert(localNode); this.insert(localNode);
} }
/** /**