class SyntheticREDQueue extends Object implements BandwidthEstimator
Constructor and Description |
---|
SyntheticREDQueue(I2PAppContext ctx,
int bwBps)
Default thresholds.
|
SyntheticREDQueue(I2PAppContext ctx,
int bwBps,
int minThB,
int maxThB)
Specified queue size thresholds.
|
Modifier and Type | Method and Description |
---|---|
void |
addSample(int size)
Unconditional, never drop.
|
float |
getBandwidthEstimate() |
int |
getMaxBandwidth()
Nominal bandwidth limit in bytes per second, as passed to the constructor.
|
float |
getQueueSizeEstimate() |
boolean |
offer(int size,
float factor)
Should we drop this packet?
If accepted, the queue size and bandwidth estimates will be updated.
|
String |
toString() |
SyntheticREDQueue(I2PAppContext ctx, int bwBps)
bwBps
- the output rate of the queue in BpsSyntheticREDQueue(I2PAppContext ctx, int bwBps, int minThB, int maxThB)
bwBps
- the output rate of the queue in BpsminThB
- the minimum queue size to start dropping in BytesmaxThB
- the queue size to drop everything in Bytespublic int getMaxBandwidth()
public void addSample(int size)
addSample
in interface BandwidthEstimator
size
- how many bytes or packets were acked with this ackpublic boolean offer(int size, float factor)
size
- how many bytes to be offeredfactor
- how to adjust the size for the drop probability calculation,
or 1.0 for standard probability. 0 to prevent dropping.
Does not affect bandwidth calculations.public float getBandwidthEstimate()
getBandwidthEstimate
in interface BandwidthEstimator
public float getQueueSizeEstimate()