use of net.i2p.data.i2cp.GetBandwidthLimitsMessage in project i2p.i2p by i2p.
the class LocalClientMessageEventListener method handleGetBWLimits.
/**
* Send dummy limits
*/
@Override
protected void handleGetBWLimits(GetBandwidthLimitsMessage message) {
int limit = 1024 * 1024;
BandwidthLimitsMessage msg = new BandwidthLimitsMessage(limit, limit);
try {
_runner.doSend(msg);
} catch (I2CPMessageException ime) {
ime.printStackTrace();
}
}
use of net.i2p.data.i2cp.GetBandwidthLimitsMessage in project i2p.i2p by i2p.
the class ClientMessageEventListener method handleGetBWLimits.
/**
* Divide router limit by 1.75 for overhead.
* This could someday give a different answer to each client.
* But it's not enforced anywhere.
*/
protected void handleGetBWLimits(GetBandwidthLimitsMessage message) {
if (_log.shouldLog(Log.INFO))
_log.info("Got BW Limits request");
int in = _context.bandwidthLimiter().getInboundKBytesPerSecond() * 4 / 7;
int out = _context.bandwidthLimiter().getOutboundKBytesPerSecond() * 4 / 7;
BandwidthLimitsMessage msg = new BandwidthLimitsMessage(in, out);
try {
_runner.doSend(msg);
} catch (I2CPMessageException ime) {
if (_log.shouldLog(Log.WARN))
_log.warn("Error writing bw limits msg", ime);
}
}
Aggregations