Skip to content

Commit

Permalink
Util: Move SyntheticREDQueue from router to core
Browse files Browse the repository at this point in the history
in prep for use by i2psnark, to follow
log tweak
  • Loading branch information
zzzi2p committed Dec 23, 2023
1 parent 394a2b1 commit 3995078
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package net.i2p.router.transport;
package net.i2p.util;

import net.i2p.I2PAppContext;
import net.i2p.data.DataHelper;
import net.i2p.util.BandwidthEstimator;
import net.i2p.util.Log;

/**
* A "synthetic" queue in that it doesn't actually queue anything.
Expand Down Expand Up @@ -45,9 +43,9 @@
*
* Adapted from: Linux kernel tcp_westwood.c (GPLv2)
*
* @since 0.9.50 adapted from streaming
* @since 0.9.50 adapted from streaming; moved from transport in 0.9.62
*/
class SyntheticREDQueue implements BandwidthEstimator {
public class SyntheticREDQueue implements BandwidthEstimator {

private final I2PAppContext _context;
private final Log _log;
Expand Down Expand Up @@ -94,7 +92,7 @@ class SyntheticREDQueue implements BandwidthEstimator {
*
* @param bwBps the output rate of the queue in Bps
*/
SyntheticREDQueue(I2PAppContext ctx, int bwBps) {
public SyntheticREDQueue(I2PAppContext ctx, int bwBps) {
// the goal is to drop here rather than let the traffic
// get through to UDP-Sender CoDel and get dropped there,
// when we're at the default 80% share or below.
Expand Down Expand Up @@ -369,6 +367,8 @@ public synchronized String toString() {
' ' + DataHelper.formatSize2Decimal((long) (_bKFiltered * 1000), false) +
"Bps, avg_qsize " +
DataHelper.formatSize2((long) _avgQSize, false) +
"B]";
"B, limit " +
DataHelper.formatSize2Decimal((long) _bwBps, false) +
"Bps]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.i2p.router.RouterContext;
import net.i2p.router.transport.FIFOBandwidthLimiter.Request;
import net.i2p.util.Log;
import net.i2p.util.SyntheticREDQueue;

/**
* Thread that runs several times a second to "give" bandwidth to
Expand Down

0 comments on commit 3995078

Please sign in to comment.