Returning latency as Long.MAX_VALUE instead of zero to non-initialized FullNode instances
This commit is contained in:
parent
63eebf11c4
commit
d37d35e0c6
2 changed files with 8 additions and 4 deletions
|
@ -65,10 +65,16 @@ public class FullNode implements Comparable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return The latest latency average value
|
* @return The latest latency average value. If no measurement has been taken yet, the
|
||||||
|
* maximum allows value of a long primitive, or 2<sup>63</sup>-1 will be returned.
|
||||||
*/
|
*/
|
||||||
public double getLatencyValue() {
|
public double getLatencyValue() {
|
||||||
return mLatency.getAverage();
|
double average = mLatency.getAverage();
|
||||||
|
if(average == 0){
|
||||||
|
return Long.MAX_VALUE;
|
||||||
|
}else{
|
||||||
|
return average;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
|
|
|
@ -35,8 +35,6 @@ public class NodeLatencyVerifier {
|
||||||
|
|
||||||
private HashMap<HttpUrl, FullNode> nodeURLMap = new HashMap<>();
|
private HashMap<HttpUrl, FullNode> nodeURLMap = new HashMap<>();
|
||||||
|
|
||||||
// private WebSocket webSocket;
|
|
||||||
|
|
||||||
// Map used to store the first timestamp required for a RTT (Round Trip Time) measurement.
|
// Map used to store the first timestamp required for a RTT (Round Trip Time) measurement.
|
||||||
// If:
|
// If:
|
||||||
// RTT = t2 - t1
|
// RTT = t2 - t1
|
||||||
|
|
Loading…
Reference in a new issue