I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 5eaec4c8 authored by jrandom's avatar jrandom Committed by zzz
Browse files

only recurse one time

parent ffcc34c4
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,9 @@ class PoolingTunnelSelector { ...@@ -30,6 +30,9 @@ class PoolingTunnelSelector {
} }
public List selectOutboundTunnelIds(TunnelPool pool, TunnelSelectionCriteria criteria) { public List selectOutboundTunnelIds(TunnelPool pool, TunnelSelectionCriteria criteria) {
return selectOutboundTunnelIds(pool, criteria, true);
}
public List selectOutboundTunnelIds(TunnelPool pool, TunnelSelectionCriteria criteria, boolean recurse) {
List tunnelIds = new ArrayList(criteria.getMinimumTunnelsRequired()); List tunnelIds = new ArrayList(criteria.getMinimumTunnelsRequired());
Set outIds = pool.getOutboundTunnels(); Set outIds = pool.getOutboundTunnels();
...@@ -61,8 +64,8 @@ class PoolingTunnelSelector { ...@@ -61,8 +64,8 @@ class PoolingTunnelSelector {
pool.buildFakeTunnels(); pool.buildFakeTunnels();
rebuilt = true; rebuilt = true;
} }
if (rebuilt) if (rebuilt && recurse)
return selectOutboundTunnelIds(pool, criteria); return selectOutboundTunnelIds(pool, criteria, false);
List ordered = randomize(pool, tunnelIds); List ordered = randomize(pool, tunnelIds);
List rv = new ArrayList(criteria.getMinimumTunnelsRequired()); List rv = new ArrayList(criteria.getMinimumTunnelsRequired());
...@@ -76,6 +79,9 @@ class PoolingTunnelSelector { ...@@ -76,6 +79,9 @@ class PoolingTunnelSelector {
} }
public List selectInboundTunnelIds(TunnelPool pool, TunnelSelectionCriteria criteria) { public List selectInboundTunnelIds(TunnelPool pool, TunnelSelectionCriteria criteria) {
return selectInboundTunnelIds(pool, criteria, true);
}
public List selectInboundTunnelIds(TunnelPool pool, TunnelSelectionCriteria criteria, boolean recurse) {
List tunnels = new ArrayList(criteria.getMinimumTunnelsRequired()); List tunnels = new ArrayList(criteria.getMinimumTunnelsRequired());
for (Iterator iter = pool.getFreeTunnels().iterator(); iter.hasNext(); ) { for (Iterator iter = pool.getFreeTunnels().iterator(); iter.hasNext(); ) {
...@@ -103,8 +109,8 @@ class PoolingTunnelSelector { ...@@ -103,8 +109,8 @@ class PoolingTunnelSelector {
pool.buildFakeTunnels(); pool.buildFakeTunnels();
rebuilt = true; rebuilt = true;
} }
if (rebuilt) if (rebuilt && recurse)
return selectInboundTunnelIds(pool, criteria); return selectInboundTunnelIds(pool, criteria, false);
List ordered = randomize(pool, tunnels); List ordered = randomize(pool, tunnels);
List rv = new ArrayList(criteria.getMinimumTunnelsRequired()); List rv = new ArrayList(criteria.getMinimumTunnelsRequired());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment