forked from I2P_Developers/i2p.i2p
Console: Handle zero SSU RTT on /peers (ticket #2443)
PeerState minor cleanups
This commit is contained in:
@ -431,6 +431,7 @@ public class PeerHelper extends HelperBase {
|
||||
long resentTotal = 0;
|
||||
long dupRecvTotal = 0;
|
||||
int numPeers = 0;
|
||||
int numRTTPeers = 0;
|
||||
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3 id=\"udpcon\">").append(_t("UDP connections")).append(": ").append(peers.size());
|
||||
@ -593,7 +594,10 @@ public class PeerHelper extends HelperBase {
|
||||
int rto = peer.getRTO();
|
||||
|
||||
buf.append("<td class=\"cells\" align=\"right\">");
|
||||
if (rtt > 0)
|
||||
buf.append(DataHelper.formatDuration2(rtt));
|
||||
else
|
||||
buf.append("n/a");
|
||||
buf.append("</td>");
|
||||
|
||||
//buf.append("<td class=\"cells\" align=\"right\">");
|
||||
@ -651,7 +655,10 @@ public class PeerHelper extends HelperBase {
|
||||
|
||||
uptimeMsTotal += uptime;
|
||||
cwinTotal += sendWindow;
|
||||
if (rtt > 0) {
|
||||
rttTotal += rtt;
|
||||
numRTTPeers++;
|
||||
}
|
||||
rtoTotal += rto;
|
||||
|
||||
sendTotal += sent;
|
||||
@ -679,7 +686,10 @@ public class PeerHelper extends HelperBase {
|
||||
buf.append(cwinTotal/(numPeers*1024) + "K");
|
||||
buf.append("</b></td><td> </td>\n" +
|
||||
"<td align=\"right\"><b>");
|
||||
buf.append(DataHelper.formatDuration2(rttTotal/numPeers));
|
||||
if (numRTTPeers > 0)
|
||||
buf.append(DataHelper.formatDuration2(rttTotal/numRTTPeers));
|
||||
else
|
||||
buf.append("n/a");
|
||||
//buf.append("</b></td><td> </td><td align=\"center\"><b>");
|
||||
buf.append("</b></td><td align=\"right\"><b>");
|
||||
buf.append(DataHelper.formatDuration2(rtoTotal/numPeers));
|
||||
|
@ -1,5 +1,11 @@
|
||||
2019-02-26 zzz
|
||||
* SSU:
|
||||
- Fix scheduling of peer test at startup (ticket #2441)
|
||||
- Fix RTT/RTO calculations (ticket #2443)
|
||||
|
||||
2019-02-25 zzz
|
||||
* NetDB: Fix dup publish of RI at startup
|
||||
* NTCP: Fix number of SendFinisher threads (ticket #2438)
|
||||
|
||||
2019-02-23 zzz
|
||||
* Console: Flip order of router logs
|
||||
|
@ -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 = "";
|
||||
|
@ -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)));
|
||||
|
Reference in New Issue
Block a user