diff --git a/src/kademlia/core/DefaultConfiguration.java b/src/kademlia/core/DefaultConfiguration.java index cb2e1b3..8782d59 100644 --- a/src/kademlia/core/DefaultConfiguration.java +++ b/src/kademlia/core/DefaultConfiguration.java @@ -10,7 +10,7 @@ import java.io.File; public class DefaultConfiguration implements KadConfiguration { - private final static long RESTORE_INTERVAL = 20 * 1000; // in milliseconds + private final static long RESTORE_INTERVAL = 60 * 1000; // in milliseconds private final static long RESPONSE_TIMEOUT = 1500; private final static long OPERATION_TIMEOUT = 3000; private final static int CONCURRENCY = 10; diff --git a/src/kademlia/dht/DHT.java b/src/kademlia/dht/DHT.java index d2f87ea..051387d 100644 --- a/src/kademlia/dht/DHT.java +++ b/src/kademlia/dht/DHT.java @@ -272,11 +272,11 @@ public class DHT private String getContentStorageFolderName(KademliaId key) { /** - * Each content is stored in a folder named after the first 10 characters of the NodeId + * Each content is stored in a folder named after the first 2 characters of the NodeId * * The name of the file containing the content is the hash of this content */ - String folderName = key.hexRepresentation().substring(0, 10); + String folderName = key.hexRepresentation().substring(0, 2); File contentStorageFolder = new File(this.config.getNodeDataFolder(ownerId) + File.separator + folderName); /* Create the content folder if it doesn't exist */ diff --git a/src/kademlia/operation/ContentLookupOperation.java b/src/kademlia/operation/ContentLookupOperation.java index 2bf14f5..a9189be 100644 --- a/src/kademlia/operation/ContentLookupOperation.java +++ b/src/kademlia/operation/ContentLookupOperation.java @@ -58,12 +58,13 @@ public class ContentLookupOperation implements Operation, Receiver private final Comparator comparator; /* Statistical information */ - private RouteLengthChecker routeLengthChecker; + private final RouteLengthChecker routeLengthChecker; { messagesTransiting = new HashMap<>(); isContentFound = false; + routeLengthChecker = new RouteLengthChecker(); } /** @@ -116,7 +117,7 @@ public class ContentLookupOperation implements Operation, Receiver * keey trying until config.operationTimeout() time has expired */ int totalTimeWaited = 0; - int timeInterval = 10; // We re-check every 10 milliseconds + int timeInterval = 10; // We re-check every n milliseconds while (totalTimeWaited < this.config.operationTimeout()) { if (!this.askNodesorFinish() && !isContentFound)