Skip to content

Commit

Permalink
start implementing congestion caps handling by adding CAPABILITY_CONG…
Browse files Browse the repository at this point in the history
…ESTION_SEVER to TunnelPeerSelector.DEFAULT_EXCLUDE_CAPS
  • Loading branch information
eyedeekay committed May 12, 2023
1 parent 18a3893 commit f33ac6c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ class CapacityCalculator {
private static final double PENALTY_NO_R_CAP = 1;
private static final double PENALTY_U_CAP = 2;
private static final double PENALTY_LAST_SEND_FAIL = 4;
private static final double PENALTY_D_CAP = 1;
private static final double PENALTY_E_CAP = 2;
//private static final double PENALTY_G_CAP = 4;
private static final double PENALTY_RECENT_SEND_FAIL = 4;
private static final double BONUS_LAST_SEND_SUCCESS = 1;
private static final double BONUS_RECENT_SEND_SUCCESS = 1;
Expand Down Expand Up @@ -124,11 +127,13 @@ public static double calc(PeerProfile profile) {
capacity -= PENALTY_U_CAP;
if (caps.indexOf(Router.CAPABILITY_BW32) >= 0)
capacity -= PENALTY_L_CAP;
/* TODO
/* TODO */
if (caps.indexOf(Router.CAPABILITY_CONGESTION_MODERATE) >= 0)
capacity -= PENALTY_D_CAP;
else if (caps.indexOf(Router.CAPABILITY_CONGESTION_SEVERE) >= 0)
capacity -= PENALTY_E_CAP;
/* TODO: G caps can be excluded in TunnelPeerSelector by adding it to DEFAULT_EXCLUDE_CAPS
decide what other handling if any is needed here.
else if (caps.indexOf(Router.CAPABILITY_NO_TUNNELS) >= 0)
capacity -= PENALTY_G_CAP;
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
*/
public abstract class TunnelPeerSelector extends ConnectChecker {

private static final String DEFAULT_EXCLUDE_CAPS = String.valueOf(Router.CAPABILITY_BW12);
private static final String DEFAULT_EXCLUDE_CAPS = String.valueOf(Router.CAPABILITY_BW12)+String.valueOf(Router.CAPABILITY_CONGESTION_SEVERE);

protected TunnelPeerSelector(RouterContext context) {
super(context);
Expand Down

0 comments on commit f33ac6c

Please sign in to comment.