mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-22 02:02:21 +00:00
There was an error when we recursively called the synchronized KadBucket.insert method
- Fixed it by removing the recursion
This commit is contained in:
parent
1e2cc037de
commit
37337afc66
@ -14,7 +14,7 @@ public class DefaultConfiguration implements KadConfiguration
|
|||||||
private final static long RESPONSE_TIMEOUT = 1500;
|
private final static long RESPONSE_TIMEOUT = 1500;
|
||||||
private final static long OPERATION_TIMEOUT = 3000;
|
private final static long OPERATION_TIMEOUT = 3000;
|
||||||
private final static int CONCURRENCY = 10;
|
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 RCSIZE = 3;
|
||||||
private final static int STALE = 1;
|
private final static int STALE = 1;
|
||||||
private final static String LOCAL_FOLDER = "kademlia";
|
private final static String LOCAL_FOLDER = "kademlia";
|
||||||
|
@ -195,6 +195,8 @@ public class KadServer
|
|||||||
byte[] buffer = new byte[DATAGRAM_BUFFER_SIZE];
|
byte[] buffer = new byte[DATAGRAM_BUFFER_SIZE];
|
||||||
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
|
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
|
||||||
socket.receive(packet);
|
socket.receive(packet);
|
||||||
|
|
||||||
|
//System.out.println("Received packet of size: " + packet.getLength());
|
||||||
|
|
||||||
/* We've received a packet, now handle it */
|
/* We've received a packet, now handle it */
|
||||||
try (ByteArrayInputStream bin = new ByteArrayInputStream(packet.getData(), packet.getOffset(), packet.getLength());
|
try (ByteArrayInputStream bin = new ByteArrayInputStream(packet.getData(), packet.getOffset(), packet.getLength());
|
||||||
|
@ -57,7 +57,7 @@ public class BucketRefreshOperation implements Operation
|
|||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
System.err.println("Bucket Refresh Operation Failed. Msg: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.start();
|
}.start();
|
||||||
|
@ -82,7 +82,7 @@ public class KadBucketImpl implements KadBucket
|
|||||||
if (stalest != null)
|
if (stalest != null)
|
||||||
{
|
{
|
||||||
this.contacts.remove(stalest);
|
this.contacts.remove(stalest);
|
||||||
this.insert(c);
|
this.contacts.put(c, c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user