Changeset 20a58a2


Ignore:
Timestamp:
Oct 25, 2017 10:18:18 AM (3 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
670e56d
Parents:
bf42cc1
Message:

Use correct shared bandwidth measure in TunnelRenderer?

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/TunnelRenderer.java

    rbf42cc1 r20a58a2  
    6666        List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels();
    6767        out.write("<h3 class=\"tabletitle\" id=\"participating\">" + _t("Participating tunnels") + "</h3>\n");
    68         int bwShare = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
     68        int bwShare = getShareBandwidth();
    6969        if (bwShare > 12) {
    7070        // Don't bother re-indenting
     
    385385    }
    386386
     387    /**
     388     * Copied from ConfigNetHelper.
     389     * @return in KBytes per second
     390     */
     391    private int getShareBandwidth() {
     392        int irateKBps = _context.bandwidthLimiter().getInboundKBytesPerSecond();
     393        int orateKBps = _context.bandwidthLimiter().getOutboundKBytesPerSecond();
     394        double pct = _context.router().getSharePercentage();
     395        if (irateKBps < 0 || orateKBps < 0)
     396            return ConfigNetHelper.DEFAULT_SHARE_KBPS;
     397        return (int) (pct * Math.min(irateKBps, orateKBps));
     398    }
     399
    387400    /** translate a string */
    388401    private String _t(String s) {
  • router/java/src/net/i2p/router/RouterVersion.java

    rbf42cc1 r20a58a2  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 6;
     21    public final static long BUILD = 7;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.