Compare commits

...

1 Commits

Author SHA1 Message Date
zzz
158213b86c limiter updates
- Handle IBGW max BW param (prop. 168)
- Set allocated BW in config for all tunnels for display
- Display allocated BW on /tunnels

more fixes to follow
2025-08-09 10:16:11 -04:00
5 changed files with 26 additions and 6 deletions

View File

@@ -112,7 +112,7 @@ class TunnelRenderer {
DataHelper.sort(participating, new TunnelComparator());
out.write("<table class=\"tunneldisplay tunnels_participating\"><tr><th>" + _t("Receive on") + "</th><th>" + _t("From") + "</th><th>"
+ _t("Send on") + "</th><th>" + _t("To") + "</th><th>" + _t("Expiration") + "</th>"
+ "<th>" + _t("Usage") + "</th><th>" + _t("Rate") + "</th><th>" + _t("Role") + "</th></tr>\n");
+ "<th>" + _t("Usage") + "</th><th>" + _t("Rate") + "</th><th>" + _t("Limit") + "</th><th>" + _t("Role") + "</th></tr>\n");
}
long processed = 0;
RateStat rs = _context.statManager().getRate("tunnel.participatingMessageCount");
@@ -167,6 +167,7 @@ class TunnelRenderer {
lifetime = 10*60;
long bps = 1024L * count / lifetime;
out.write("<td class=\"cells\" align=\"center\">" + DataHelper.formatSize2Decimal(bps) + "Bps</td>");
out.write("<td class=\"cells\" align=\"center\">" + DataHelper.formatSize2Decimal(cfg.getAllocatedBW()) + "Bps</td>");
if (to == null)
out.write("<td class=\"cells\" align=\"center\">" + _t("Outbound Endpoint") + "</td>");
else if (from == null)

View File

@@ -34,8 +34,10 @@ class OutboundTunnelEndpoint {
_processor = processor;
_handler = new FragmentHandler(ctx, new DefragmentedHandler(), false);
int max = _config.getAllocatedBW();
if (max <= TunnelParticipant.DEFAULT_BW_PER_TUNNEL_ESTIMATE)
if (max <= TunnelParticipant.DEFAULT_BW_PER_TUNNEL_ESTIMATE) {
max = _context.tunnelDispatcher().getMaxPerTunnelBandwidth(TunnelDispatcher.Location.OBEP);
_config.setAllocatedBW(max);
}
_partBWE = new SyntheticREDQueue(_context, max);
_outDistributor = new OutboundMessageDistributor(ctx, OutNetMessage.PRIORITY_PARTICIPATING, _partBWE);
}

View File

@@ -22,8 +22,10 @@ class ThrottledPumpedTunnelGateway extends PumpedTunnelGateway {
super(context, preprocessor, sender, receiver, pumper);
_config = config;
int max = _config.getAllocatedBW();
if (max <= TunnelParticipant.DEFAULT_BW_PER_TUNNEL_ESTIMATE)
if (max <= TunnelParticipant.DEFAULT_BW_PER_TUNNEL_ESTIMATE) {
max = _context.tunnelDispatcher().getMaxPerTunnelBandwidth(TunnelDispatcher.Location.IBGW);
_config.setAllocatedBW(max);
}
_partBWE = new SyntheticREDQueue(_context, max);
}

View File

@@ -75,8 +75,10 @@ class TunnelParticipant {
}
if (inEndProc == null) {
int max = _config.getAllocatedBW();
if (max <= DEFAULT_BW_PER_TUNNEL_ESTIMATE)
if (max <= DEFAULT_BW_PER_TUNNEL_ESTIMATE) {
max = _context.tunnelDispatcher().getMaxPerTunnelBandwidth(TunnelDispatcher.Location.PARTICIPANT);
_config.setAllocatedBW(max);
}
_partBWE = new SyntheticREDQueue(_context, max);
} else {
_partBWE = null;

View File

@@ -928,6 +928,7 @@ class BuildHandler implements Runnable {
if (props != null && !props.isEmpty()) {
int min = 0;
int rqu = 0;
int ibgwmax = 0;
String smin = props.getProperty(BuildRequestor.PROP_MIN_BW);
if (smin != null) {
try {
@@ -944,7 +945,17 @@ class BuildHandler implements Runnable {
response = TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
}
}
if ((min > 0 || rqu > 0) && response == 0) {
if (isInGW) {
String smax = props.getProperty(BuildRequestor.PROP_MAX_BW);
if (smax != null) {
try {
ibgwmax = 1000 * Integer.parseInt(smax);
} catch (NumberFormatException nfe) {
response = TunnelHistory.TUNNEL_REJECT_BANDWIDTH;
}
}
}
if ((min > 0 || rqu > 0 || ibgwmax > 0) && response == 0) {
int share = 1000 * TunnelDispatcher.getShareBandwidth(_context);
int max = share / 20;
if (min > max) {
@@ -965,8 +976,10 @@ class BuildHandler implements Runnable {
rqu = 4 * min;
if (rqu > 0 && rqu < avail)
avail = rqu;
if (ibgwmax > 0 && ibgwmax < avail)
avail = ibgwmax;
if (_log.shouldWarn())
_log.warn("ACCEPT Part tunnel: min: " + min + " req: " + rqu + " avail: " + avail);
_log.warn("ACCEPT Part tunnel: min: " + min + " req: " + rqu + " max: " + ibgwmax + " avail: " + avail);
}
}
}