Use correct shared bandwidth measure in TunnelRenderer

This commit is contained in:
str4d
2017-10-25 10:18:18 +00:00
parent bf42cc1594
commit 20a58a24bb
2 changed files with 15 additions and 2 deletions

View File

@ -65,7 +65,7 @@ class TunnelRenderer {
List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels();
out.write("<h3 class=\"tabletitle\" id=\"participating\">" + _t("Participating tunnels") + "</h3>\n");
int bwShare = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
int bwShare = getShareBandwidth();
if (bwShare > 12) {
// Don't bother re-indenting
if (!participating.isEmpty()) {
@ -384,6 +384,19 @@ class TunnelRenderer {
return _context.commSystem().renderPeerHTML(peer);
}
/**
* Copied from ConfigNetHelper.
* @return in KBytes per second
*/
private int getShareBandwidth() {
int irateKBps = _context.bandwidthLimiter().getInboundKBytesPerSecond();
int orateKBps = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
double pct = _context.router().getSharePercentage();
if (irateKBps < 0 || orateKBps < 0)
return ConfigNetHelper.DEFAULT_SHARE_KBPS;
return (int) (pct * Math.min(irateKBps, orateKBps));
}
/** translate a string */
private String _t(String s) {
return Messages.getString(s, _context);

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 = 6;
public final static long BUILD = 7;
/** for example "-test" */
public final static String EXTRA = "";