public class SyntheticREDQueue extends Object implements BandwidthEstimator
| Constructor and Description |
|---|
SyntheticREDQueue(I2PAppContext ctx,
int bwBps)
Construct with default queue size thresholds based on bandwidth.
|
SyntheticREDQueue(I2PAppContext ctx,
int bwBps,
int minThB,
int maxThB)
Construct specifying bandwidth and queue size thresholds.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSample(int size)
Unconditionally accepts the given packet size.
|
float |
getBandwidthEstimate()
Returns the current bandwidth estimate in bytes/ms.
|
int |
getMaxBandwidth() |
float |
getQueueSizeEstimate()
Returns the current estimated average queue size in bytes.
|
boolean |
offer(int size,
float factor)
Offer a packet to the queue.
|
String |
toString()
Returns a human-readable string displaying the current bandwidth and queue size estimates,
formatted for debugging or informational output.
|
public SyntheticREDQueue(I2PAppContext ctx, int bwBps)
ctx - the I2P application contextbwBps - nominal output bandwidth in bytes per secondpublic SyntheticREDQueue(I2PAppContext ctx, int bwBps, int minThB, int maxThB)
ctx - the I2P application contextbwBps - nominal output bandwidth in bytes per secondminThB - minimum threshold queue size to start dropping (Bytes)maxThB - maximum threshold queue size to drop all packets (Bytes)public void addSample(int size)
addSample in interface BandwidthEstimatorsize - size of packet in bytespublic float getBandwidthEstimate()
getBandwidthEstimate in interface BandwidthEstimatorpublic int getMaxBandwidth()
public float getQueueSizeEstimate()
public boolean offer(int size,
float factor)
size - size in bytes of the packetfactor - drop probability adjustment factor (1.0 for standard, 0 disables dropping)