Changeset 8745ffd


Ignore:
Timestamp:
Mar 17, 2010 4:18:25 PM (10 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
80654b2
Parents:
db99e98
Message:
  • config.jsp: Set burst to +10% for 20s by default, to fix bug where the burst stays high when limits are reduced.
File:
1 edited

Legend:

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

    rdb99e98 r8745ffd  
    299299    }
    300300   
     301    private static final int DEF_BURST_PCT = 10;
     302    private static final int DEF_BURST_TIME = 20;
     303
    301304    private void updateRates() {
    302305        boolean updated = false;
     
    311314        }
    312315
     316        // Since burst is now hidden in the gui, set burst to +10% for 20 seconds
    313317        if ( (_inboundRate != null) && (_inboundRate.length() > 0) &&
    314318            !_inboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_INBOUND_BANDWIDTH))) {
    315319            _context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH, _inboundRate);
     320            try {
     321                int rate = Integer.parseInt(_inboundRate) * (100 + DEF_BURST_PCT) / 100;
     322                int kb = DEF_BURST_TIME * rate;
     323                _context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BURST_BANDWIDTH, "" + rate);
     324                _context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH_PEAK, "" + kb);
     325            } catch (NumberFormatException nfe) {}
    316326            updated = true;
    317327        }
     
    319329            !_outboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_OUTBOUND_BANDWIDTH))) {
    320330            _context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH, _outboundRate);
     331            try {
     332                int rate = Integer.parseInt(_outboundRate) * (100 + DEF_BURST_PCT) / 100;
     333                int kb = DEF_BURST_TIME * rate;
     334                _context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BURST_BANDWIDTH, "" + rate);
     335                _context.router().setConfigSetting(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH_PEAK, "" + kb);
     336            } catch (NumberFormatException nfe) {}
    321337            updated = true;
    322338        }
Note: See TracChangeset for help on using the changeset viewer.