diff --git a/router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java b/router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java index 4127eb673df09e53b98b090b2e75b5d8e6825d5d..05a9027f74ba0d9422382b1c4682cebb795c2f61 100644 --- a/router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java +++ b/router/java/src/net/i2p/router/transport/FIFOBandwidthLimiter.java @@ -21,6 +21,8 @@ public class FIFOBandwidthLimiter { private boolean _inboundUnlimited; private volatile long _totalAllocatedInboundBytes; private volatile long _totalAllocatedOutboundBytes; + private volatile long _totalWastedInboundBytes; + private volatile long _totalWastedOutboundBytes; private int _maxInboundBytes; private int _maxOutboundBytes; private FIFOBandwidthRefiller _refiller; @@ -48,6 +50,8 @@ public class FIFOBandwidthLimiter { public long getAvailableOutboundBytes() { return _availableOutboundBytes; } public long getTotalAllocatedInboundBytes() { return _totalAllocatedInboundBytes; } public long getTotalAllocatedOutboundBytes() { return _totalAllocatedOutboundBytes; } + public long getTotalWastedInboundBytes() { return _totalWastedInboundBytes; } + public long getTotalWastedOutboundBytes() { return _totalWastedOutboundBytes; } public long getMaxInboundBytes() { return _maxInboundBytes; } public void setMaxInboundBytes(int numBytes) { _maxInboundBytes = numBytes; } public long getMaxOutboundBytes() { return _maxOutboundBytes; } @@ -109,10 +113,14 @@ public class FIFOBandwidthLimiter { _log.debug("Refilling the queues with " + bytesInbound + "/" + bytesOutbound); _availableInboundBytes += bytesInbound; _availableOutboundBytes += bytesOutbound; - if (_availableInboundBytes > _maxInboundBytes) + if (_availableInboundBytes > _maxInboundBytes) { + _totalWastedInboundBytes += (_availableInboundBytes - _maxInboundBytes); _availableInboundBytes = _maxInboundBytes; - if (_availableOutboundBytes > _maxOutboundBytes) + } + if (_availableOutboundBytes > _maxOutboundBytes) { + _totalWastedOutboundBytes += (_availableOutboundBytes - _maxOutboundBytes); _availableOutboundBytes = _maxOutboundBytes; + } satisfyRequests(); }