Changeset f32d3aae
- Timestamp:
- Jan 6, 2018 4:15:15 PM (3 years ago)
- Branches:
- master
- Children:
- 25d16b13
- Parents:
- b8f17c7
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigNetHandler.java
rb8f17c7 rf32d3aae 44 44 private boolean _laptop; 45 45 private String _inboundRate; 46 private String _inboundBurstRate;47 private String _inboundBurst;46 //private String _inboundBurstRate; 47 //private String _inboundBurst; 48 48 private String _outboundRate; 49 private String _outboundBurstRate;50 private String _outboundBurst;49 //private String _outboundBurstRate; 50 //private String _outboundBurst; 51 51 private String _sharePct; 52 52 private boolean _ratesOnly; … … 115 115 _inboundRate = (rate != null ? rate.trim() : null); 116 116 } 117 118 /* 117 119 public void setInboundburstrate(String rate) { 118 120 _inboundBurstRate = (rate != null ? rate.trim() : null); … … 121 123 _inboundBurst = (factor != null ? factor.trim() : null); 122 124 } 125 ****/ 126 123 127 public void setOutboundrate(String rate) { 124 128 _outboundRate = (rate != null ? rate.trim() : null); 125 129 } 130 131 /* 126 132 public void setOutboundburstrate(String rate) { 127 133 _outboundBurstRate = (rate != null ? rate.trim() : null); … … 130 136 _outboundBurst = (factor != null ? factor.trim() : null); 131 137 } 138 ****/ 139 132 140 public void setSharePercentage(String pct) { 133 141 _sharePct = (pct != null ? pct.trim() : null); … … 488 496 } 489 497 490 // Since burst is now hidden in the gui, set burst to +10% for 20 seconds 498 // Since burst is now hidden in the gui, set burst to +10% for 20 seconds (prior to 0.9.33) 499 // As of 0.9.33, we set strict bandwidth limits. Specified rate is the burst rate, 500 // and we set the standard rate to 50KB or 10% lower (whichever is less). 491 501 if ( (_inboundRate != null) && (_inboundRate.length() > 0) && 492 !_inboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_INBOUND_B ANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_INBOUND_BANDWIDTH))) {493 changes.put(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH, _inboundRate);502 !_inboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_INBOUND_BURST_BANDWIDTH, 503 Integer.toString(FIFOBandwidthRefiller.DEFAULT_INBOUND_BURST_BANDWIDTH)))) { 494 504 try { 495 int rate = Integer.parseInt(_inboundRate) * (100 + DEF_BURST_PCT) / 100;505 int rate = Integer.parseInt(_inboundRate); 496 506 int kb = DEF_BURST_TIME * rate; 497 changes.put(FIFOBandwidthRefiller.PROP_INBOUND_BURST_BANDWIDTH, "" + rate); 498 changes.put(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH_PEAK, "" + kb); 499 } catch (NumberFormatException nfe) {} 500 bwUpdated = true; 507 changes.put(FIFOBandwidthRefiller.PROP_INBOUND_BURST_BANDWIDTH, Integer.toString(rate)); 508 changes.put(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH_PEAK, Integer.toString(kb)); 509 rate -= Math.min(rate * DEF_BURST_PCT / 100, 50); 510 changes.put(FIFOBandwidthRefiller.PROP_INBOUND_BANDWIDTH, Integer.toString(rate)); 511 bwUpdated = true; 512 } catch (NumberFormatException nfe) { 513 addFormError(_t("Invalid bandwidth")); 514 } 501 515 } 502 516 if ( (_outboundRate != null) && (_outboundRate.length() > 0) && 503 !_outboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_OUTBOUND_B ANDWIDTH, "" + FIFOBandwidthRefiller.DEFAULT_OUTBOUND_BANDWIDTH))) {504 changes.put(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH, _outboundRate);517 !_outboundRate.equals(_context.getProperty(FIFOBandwidthRefiller.PROP_OUTBOUND_BURST_BANDWIDTH, 518 Integer.toString(FIFOBandwidthRefiller.DEFAULT_OUTBOUND_BURST_BANDWIDTH)))) { 505 519 try { 506 int rate = Integer.parseInt(_outboundRate) * (100 + DEF_BURST_PCT) / 100;520 int rate = Integer.parseInt(_outboundRate); 507 521 int kb = DEF_BURST_TIME * rate; 508 changes.put(FIFOBandwidthRefiller.PROP_OUTBOUND_BURST_BANDWIDTH, "" + rate); 509 changes.put(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH_PEAK, "" + kb); 510 } catch (NumberFormatException nfe) {} 511 bwUpdated = true; 522 changes.put(FIFOBandwidthRefiller.PROP_OUTBOUND_BURST_BANDWIDTH, Integer.toString(rate)); 523 changes.put(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH_PEAK, Integer.toString(kb)); 524 rate -= Math.min(rate * DEF_BURST_PCT / 100, 50); 525 changes.put(FIFOBandwidthRefiller.PROP_OUTBOUND_BANDWIDTH, Integer.toString(rate)); 526 bwUpdated = true; 527 } catch (NumberFormatException nfe) { 528 addFormError(_t("Invalid bandwidth")); 529 } 512 530 } 513 531 -
apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigNetHelper.java
rb8f17c7 rf32d3aae 236 236 237 237 public String getInboundRate() { 238 return "" + _context.bandwidthLimiter().getInboundKBytesPerSecond(); 239 } 238 return Integer.toString(_context.bandwidthLimiter().getInboundKBytesPerSecond()); 239 } 240 240 241 public String getOutboundRate() { 241 return "" + _context.bandwidthLimiter().getOutboundKBytesPerSecond(); 242 } 243 public String getInboundRateBits() { 244 return kbytesToBits(_context.bandwidthLimiter().getInboundKBytesPerSecond()); 245 } 246 public String getOutboundRateBits() { 247 return kbytesToBits(_context.bandwidthLimiter().getOutboundKBytesPerSecond()); 248 } 242 return Integer.toString(_context.bandwidthLimiter().getOutboundKBytesPerSecond()); 243 } 244 245 public String getInboundBurstRateBits() { 246 return kbytesToBits(_context.bandwidthLimiter().getInboundBurstKBytesPerSecond()); 247 } 248 249 public String getOutboundBurstRateBits() { 250 return kbytesToBits(_context.bandwidthLimiter().getOutboundBurstKBytesPerSecond()); 251 } 252 249 253 public String getShareRateBits() { 250 254 return kbytesToBits(getShareBandwidth()); … … 254 258 ' ' + _t("or {0} bytes per month maximum", DataHelper.formatSize(kbytes * (1024L * 60 * 60 * 24 * 31))); 255 259 } 260 256 261 public String getInboundBurstRate() { 257 return "" + _context.bandwidthLimiter().getInboundBurstKBytesPerSecond(); 258 } 262 return Integer.toString(_context.bandwidthLimiter().getInboundBurstKBytesPerSecond()); 263 } 264 259 265 public String getOutboundBurstRate() { 260 return "" + _context.bandwidthLimiter().getOutboundBurstKBytesPerSecond(); 261 } 266 return Integer.toString(_context.bandwidthLimiter().getOutboundBurstKBytesPerSecond()); 267 } 268 269 /* 262 270 public String getInboundBurstFactorBox() { 263 271 int numSeconds = 1; … … 302 310 } 303 311 304 /** removed */305 312 public String getEnableLoadTesting() { 306 313 return ""; 307 314 } 315 ****/ 308 316 309 317 public String getSharePercentageBox() { -
apps/routerconsole/jsp/config.jsp
rb8f17c7 rf32d3aae 31 31 <b><%=intl._t("I2P will work best if you configure your rates to match the speed of your internet connection.")%></b> 32 32 </td></tr> 33 <tr><td><input style="text-align: right; width: 5em;" name="inboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="inboundRate" />" > 33 <%-- display burst, set standard, handler will fix up --%> 34 <tr><td><input style="text-align: right; width: 5em;" name="inboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="inboundBurstRate" />" > 34 35 <%=intl._t("KBps In")%> 35 </td><td>(<jsp:getProperty name="nethelper" property="inbound RateBits" />)</td>36 <% /********36 </td><td>(<jsp:getProperty name="nethelper" property="inboundBurstRateBits" />)</td> 37 <%-- 37 38 <!-- let's keep this simple... 38 39 bursting up to … … 40 41 <jsp:getProperty name="nethelper" property="inboundBurstFactorBox" /><br> 41 42 --> 42 *********/%>43 --%> 43 44 </tr><tr> 44 <td><input style="text-align: right; width: 5em;" name="outboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="outboundRate" />" > 45 <%-- display burst, set standard, handler will fix up --%> 46 <td><input style="text-align: right; width: 5em;" name="outboundrate" type="text" size="5" maxlength="5" value="<jsp:getProperty name="nethelper" property="outboundBurstRate" />" > 45 47 <%=intl._t("KBps Out")%> 46 </td><td>(<jsp:getProperty name="nethelper" property="outbound RateBits" />)</td>47 <% /********48 </td><td>(<jsp:getProperty name="nethelper" property="outboundBurstRateBits" />)</td> 49 <%-- 48 50 <!-- let's keep this simple... 49 51 bursting up to … … 53 55 A negative rate sets the default.</i><br> 54 56 --> 55 *********/%>57 --%> 56 58 </tr><tr> 57 59 <td><jsp:getProperty name="nethelper" property="sharePercentageBox" /> <%=intl._t("Share")%></td> -
router/java/src/net/i2p/router/transport/FIFOBandwidthRefiller.java
rb8f17c7 rf32d3aae 234 234 if (_inboundBurstKBytesPerSecond <= 0) 235 235 _inboundBurstKBytesPerSecond = DEFAULT_INBOUND_BURST_BANDWIDTH; 236 if (_inboundBurstKBytesPerSecond < _inboundKBytesPerSecond) 237 _inboundBurstKBytesPerSecond = _inboundKBytesPerSecond; 236 238 _limiter.setInboundBurstKBps(_inboundBurstKBytesPerSecond); 237 239 } … … 251 253 if (_outboundBurstKBytesPerSecond <= 0) 252 254 _outboundBurstKBytesPerSecond = DEFAULT_OUTBOUND_BURST_BANDWIDTH; 255 if (_outboundBurstKBytesPerSecond < _outboundKBytesPerSecond) 256 _outboundBurstKBytesPerSecond = _outboundKBytesPerSecond; 253 257 _limiter.setOutboundBurstKBps(_outboundBurstKBytesPerSecond); 254 258 }
Note: See TracChangeset
for help on using the changeset viewer.