forked from I2P_Developers/i2p.i2p
Use correct shared bandwidth measure in TunnelRenderer
This commit is contained in:
@ -65,7 +65,7 @@ class TunnelRenderer {
|
|||||||
|
|
||||||
List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels();
|
List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels();
|
||||||
out.write("<h3 class=\"tabletitle\" id=\"participating\">" + _t("Participating tunnels") + "</h3>\n");
|
out.write("<h3 class=\"tabletitle\" id=\"participating\">" + _t("Participating tunnels") + "</h3>\n");
|
||||||
int bwShare = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
|
int bwShare = getShareBandwidth();
|
||||||
if (bwShare > 12) {
|
if (bwShare > 12) {
|
||||||
// Don't bother re-indenting
|
// Don't bother re-indenting
|
||||||
if (!participating.isEmpty()) {
|
if (!participating.isEmpty()) {
|
||||||
@ -384,6 +384,19 @@ class TunnelRenderer {
|
|||||||
return _context.commSystem().renderPeerHTML(peer);
|
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 */
|
/** translate a string */
|
||||||
private String _t(String s) {
|
private String _t(String s) {
|
||||||
return Messages.getString(s, _context);
|
return Messages.getString(s, _context);
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 6;
|
public final static long BUILD = 7;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user