mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-21 17:52:21 +00:00
Updated the bucket refresh operation to use 1 thread to update each bucket
This commit is contained in:
parent
cabb5af742
commit
796e41dd9a
@ -40,12 +40,26 @@ public class BucketRefreshOperation implements Operation
|
||||
for (int i = 1; i < NodeId.ID_LENGTH; i++)
|
||||
{
|
||||
/* Construct a NodeId that is i bits away from the current node Id */
|
||||
NodeId current = this.localNode.getNodeId().generateNodeIdByDistance(i);
|
||||
final NodeId current = this.localNode.getNodeId().generateNodeIdByDistance(i);
|
||||
|
||||
// System.out.println("Distance: " + localNode.getNodeId().getDistance(current) + " - ID: " + current);
|
||||
/* Run the Node Lookup Operation, each in a different thread to speed up things */
|
||||
new Thread()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Distance: " + localNode.getNodeId().getDistance(current) + " - ID: " + current);
|
||||
|
||||
/* Run the Node Lookup Operation */
|
||||
new NodeLookupOperation(this.server, this.localNode, this.localNode.getNodeId()).execute();
|
||||
new NodeLookupOperation(server, localNode, localNode.getNodeId()).execute();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user