mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-25 03:32:19 +00:00
KadServer
- Introduced artificial latency when we're in testing mode ContentLookup & NodeLookup Operations - Reduce the wait time between data checks to 10 milliseconds
This commit is contained in:
parent
e771c8fd44
commit
1d5d8004df
@ -214,6 +214,15 @@ public class KadServer
|
||||
* Simulating network latency
|
||||
* We pause for 1 millisecond/100 bytes
|
||||
*/
|
||||
int pause = packet.getLength() / 100;
|
||||
try
|
||||
{
|
||||
Thread.sleep(pause);
|
||||
}
|
||||
catch (InterruptedException ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* We've received a packet, now handle it */
|
||||
|
@ -112,7 +112,7 @@ public class ContentLookupOperation implements Operation, Receiver
|
||||
* keey trying until config.operationTimeout() time has expired
|
||||
*/
|
||||
int totalTimeWaited = 0;
|
||||
int timeInterval = 100; // We re-check every 300 milliseconds
|
||||
int timeInterval = 10; // We re-check every 10 milliseconds
|
||||
while (totalTimeWaited < this.config.operationTimeout())
|
||||
{
|
||||
if (!this.askNodesorFinish() && !isContentFound)
|
||||
|
@ -12,7 +12,6 @@ import kademlia.KademliaNode;
|
||||
import kademlia.core.KadConfiguration;
|
||||
import kademlia.core.KadServer;
|
||||
import kademlia.exceptions.RoutingException;
|
||||
import kademlia.exceptions.UnknownMessageException;
|
||||
import kademlia.message.Message;
|
||||
import kademlia.message.NodeLookupMessage;
|
||||
import kademlia.message.NodeReplyMessage;
|
||||
@ -101,7 +100,7 @@ public class NodeLookupOperation implements Operation, Receiver
|
||||
|
||||
/* If we haven't finished as yet, wait for a maximum of config.operationTimeout() time */
|
||||
int totalTimeWaited = 0;
|
||||
int timeInterval = 50; // We re-check every 300 milliseconds
|
||||
int timeInterval = 10; // We re-check every 300 milliseconds
|
||||
while (totalTimeWaited < this.config.operationTimeout())
|
||||
{
|
||||
if (!this.askNodesorFinish())
|
||||
|
Loading…
Reference in New Issue
Block a user