mirror of
https://github.com/ChronosX88/KademliaDHT.git
synced 2024-11-22 02:02:21 +00:00
In the content lookup statistics - added a value "isContentFound" to be passed
This commit is contained in:
parent
fca4a5fde5
commit
42da6df375
@ -50,10 +50,11 @@ public interface KadStatistician
|
||||
/**
|
||||
* Add the timing for a new content lookup operation that took place
|
||||
*
|
||||
* @param time The time the content lookup took in nanoseconds
|
||||
* @param routeLength The length of the route it took to get the content
|
||||
* @param time The time the content lookup took in nanoseconds
|
||||
* @param routeLength The length of the route it took to get the content
|
||||
* @param isSuccessful Whether the content lookup was successful or not
|
||||
*/
|
||||
public void addContentLookup(long time, int routeLength);
|
||||
public void addContentLookup(long time, int routeLength, boolean isSuccessful);
|
||||
|
||||
/**
|
||||
* @return The total number of content lookups performed.
|
||||
|
@ -347,7 +347,7 @@ public class KademliaNode
|
||||
ContentLookupOperation clo = new ContentLookupOperation(server, this, param, this.config);
|
||||
clo.execute();
|
||||
long endTime = System.nanoTime();
|
||||
this.statistician.addContentLookup(endTime - startTime, clo.routeLength());
|
||||
this.statistician.addContentLookup(endTime - startTime, clo.routeLength(), clo.isContentFound());
|
||||
return clo.getContentFound();
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class Statistician implements KadStatistician
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addContentLookup(long time, int routeLength)
|
||||
public void addContentLookup(long time, int routeLength, boolean isSuccessful)
|
||||
{
|
||||
this.numContentLookups++;
|
||||
this.totalContentLookupTime += time;
|
||||
|
@ -307,6 +307,14 @@ public class ContentLookupOperation implements Operation, Receiver
|
||||
this.askNodesorFinish();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether the content was found or not.
|
||||
*/
|
||||
public boolean isContentFound()
|
||||
{
|
||||
return this.isContentFound;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The list of all content found during the lookup operation
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user