This commit is contained in:
jrandom
2004-06-13 20:27:44 +00:00
committed by zzz
parent 0a479be370
commit deff14dfd8

View File

@ -146,7 +146,8 @@ public class TrivialBandwidthLimiter extends BandwidthLimiter {
* Note that numBytes have been read from the peer * Note that numBytes have been read from the peer
*/ */
public void consumeInbound(RouterIdentity peer, int numBytes) { public void consumeInbound(RouterIdentity peer, int numBytes) {
_totalInboundBytes += numBytes; if (numBytes > 0)
_totalInboundBytes += numBytes;
if (_inboundKBytesPerSecond > 0) if (_inboundKBytesPerSecond > 0)
_inboundAvailable -= numBytes; _inboundAvailable -= numBytes;
} }
@ -155,7 +156,8 @@ public class TrivialBandwidthLimiter extends BandwidthLimiter {
* Note that numBytes have been sent to the peer * Note that numBytes have been sent to the peer
*/ */
public void consumeOutbound(RouterIdentity peer, int numBytes) { public void consumeOutbound(RouterIdentity peer, int numBytes) {
_totalOutboundBytes += numBytes; if (numBytes > 0)
_totalOutboundBytes += numBytes;
if (_outboundKBytesPerSecond > 0) if (_outboundKBytesPerSecond > 0)
_outboundAvailable -= numBytes; _outboundAvailable -= numBytes;
} }