There was an error when we recursively called the synchronized KadBucket.insert method

- Fixed it by removing the recursion
This commit is contained in:
Joshua Kissoon 2014-05-05 12:46:44 +05:30
parent 1e2cc037de
commit 37337afc66
4 changed files with 5 additions and 3 deletions

View File

@ -14,7 +14,7 @@ public class DefaultConfiguration implements KadConfiguration
private final static long RESPONSE_TIMEOUT = 1500;
private final static long OPERATION_TIMEOUT = 3000;
private final static int CONCURRENCY = 10;
private final static int K = 3;
private final static int K = 10;
private final static int RCSIZE = 3;
private final static int STALE = 1;
private final static String LOCAL_FOLDER = "kademlia";

View File

@ -195,6 +195,8 @@ public class KadServer
byte[] buffer = new byte[DATAGRAM_BUFFER_SIZE];
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
socket.receive(packet);
//System.out.println("Received packet of size: " + packet.getLength());
/* We've received a packet, now handle it */
try (ByteArrayInputStream bin = new ByteArrayInputStream(packet.getData(), packet.getOffset(), packet.getLength());

View File

@ -57,7 +57,7 @@ public class BucketRefreshOperation implements Operation
}
catch (IOException e)
{
e.printStackTrace();
System.err.println("Bucket Refresh Operation Failed. Msg: " + e.getMessage());
}
}
}.start();

View File

@ -82,7 +82,7 @@ public class KadBucketImpl implements KadBucket
if (stalest != null)
{
this.contacts.remove(stalest);
this.insert(c);
this.contacts.put(c, c);
}
else
{