Tunnels: Use connected peer for closest inbound hop when

approaching conn limits to increase tunnel build success

This should reduce chances of tunnel builds pushing us over conn limits,
and reduce build failures and watchdog warnings when at conn limits.
This commit is contained in:
zzz
2021-11-12 07:21:27 -05:00
parent dad2bed334
commit e3be6b50ce
4 changed files with 26 additions and 3 deletions
@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Git";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 4;
public final static long BUILD = 5;
/** for example "-test" */
public final static String EXTRA = "";
@@ -53,7 +53,8 @@ class ClientPeerSelector extends TunnelPeerSelector {
boolean ssuDisabled = isSSUDisabled();
boolean checkClosestHop = v6Only || ntcpDisabled || ssuDisabled;
boolean hidden = ctx.router().isHidden() ||
ctx.router().getRouterInfo().getAddressCount() <= 0;
ctx.router().getRouterInfo().getAddressCount() <= 0 ||
!ctx.commSystem().haveInboundCapacity(95);
boolean hiddenInbound = hidden && isInbound;
boolean hiddenOutbound = hidden && !isInbound;
@@ -65,7 +65,8 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
boolean ssuDisabled = nonzero && isSSUDisabled();
boolean checkClosestHop = v6Only || ntcpDisabled || ssuDisabled;
boolean hidden = nonzero && (ctx.router().isHidden() ||
ctx.router().getRouterInfo().getAddressCount() <= 0);
ctx.router().getRouterInfo().getAddressCount() <= 0 ||
!ctx.commSystem().haveInboundCapacity(95));
boolean hiddenInbound = hidden && isInbound;
boolean hiddenOutbound = hidden && !isInbound;
boolean lowOutbound = nonzero && !isInbound && !ctx.commSystem().haveHighOutboundCapacity();