Console: Handle zero SSU RTT on /peers (ticket #2443)

PeerState minor cleanups
This commit is contained in:
zzz
2019-02-26 17:38:34 +00:00
parent cf1c0cb3ed
commit c8b7e829db
4 changed files with 23 additions and 10 deletions

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 10;
public final static long BUILD = 11;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -1237,14 +1237,11 @@ public class PeerState {
if (_rtt <= 0) {
// first measurement
_rtt = (int) lifetime;
_rttDeviation = (int)(lifetime / 2);
_rttDeviation = _rtt / 2;
} else {
// the rttDev calculation matches that recommended in RFC 2988 (beta = 1/4)
_rttDeviation = (int)( 0.75*_rttDeviation + 0.25*Math.abs(lifetime-_rtt) );
float scale = RTT_DAMPENING;
_rtt = (int)(_rtt*(1.0f-scale) + (scale)*lifetime);
_rttDeviation = (int)((0.75 * _rttDeviation) + (0.25 * Math.abs(lifetime - _rtt)));
_rtt = (int)((_rtt * (1.0f - RTT_DAMPENING)) + (RTT_DAMPENING * lifetime));
}
// K = 4
_rto = Math.min(MAX_RTO, Math.max(minRTO(), _rtt + (_rttDeviation<<2)));