Returning latency as Long.MAX_VALUE instead of zero to non-initialized FullNode instances

develop
Nelson R. Perez 2018-10-18 17:57:27 -05:00
parent 63eebf11c4
commit d37d35e0c6
2 changed files with 8 additions and 4 deletions

View File

@ -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() {
return mLatency.getAverage();
double average = mLatency.getAverage();
if(average == 0){
return Long.MAX_VALUE;
}else{
return average;
}
}
public boolean isConnected() {

View File

@ -35,8 +35,6 @@ public class NodeLatencyVerifier {
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.
// If:
// RTT = t2 - t1