mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-21 17:52:21 +00:00
Made a few KadBucket methods private
Changed the comparison of KademliaId to use the hashcode
This commit is contained in:
parent
e8f0e20a8f
commit
58696d627a
@ -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 = 10;
|
||||
private final static int K = 5;
|
||||
private final static int RCSIZE = 3;
|
||||
private final static int STALE = 1;
|
||||
private final static String LOCAL_FOLDER = "kademlia";
|
||||
|
@ -95,7 +95,7 @@ public class KademliaId implements Streamable
|
||||
if (o instanceof KademliaId)
|
||||
{
|
||||
KademliaId nid = (KademliaId) o;
|
||||
return Arrays.equals(this.getBytes(), nid.getBytes());
|
||||
return this.hashCode() == nid.hashCode();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -111,11 +111,11 @@ public class Node implements Streamable
|
||||
if (o instanceof Node)
|
||||
{
|
||||
Node n = (Node) o;
|
||||
if (o == this)
|
||||
if (n == this)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return this.getNodeId().equals(((Node) o).getNodeId());
|
||||
return this.getNodeId().equals(n.getNodeId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class KadBucketImpl implements KadBucket
|
||||
return true;
|
||||
}
|
||||
|
||||
public synchronized Contact getFromContacts(Node n)
|
||||
private synchronized Contact getFromContacts(Node n)
|
||||
{
|
||||
for (Contact c : this.contacts)
|
||||
{
|
||||
@ -156,7 +156,7 @@ public class KadBucketImpl implements KadBucket
|
||||
throw new NoSuchElementException("The contact does not exist in the contacts list.");
|
||||
}
|
||||
|
||||
public synchronized Contact removeFromContacts(Node n)
|
||||
private synchronized Contact removeFromContacts(Node n)
|
||||
{
|
||||
for (Contact c : this.contacts)
|
||||
{
|
||||
@ -223,7 +223,7 @@ public class KadBucketImpl implements KadBucket
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Contact removeFromReplacementCache(Node n)
|
||||
private synchronized Contact removeFromReplacementCache(Node n)
|
||||
{
|
||||
for (Contact c : this.replacementCache)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user