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

Skip to content
Snippets Groups Projects
Unverified Commit 345c64eb authored by zzz's avatar zzz
Browse files

Tunnels: Don't build client tunnels less than min length

even if we don't have enough peers
parent 53eb6ba7
No related branches found
No related tags found
No related merge requests found
......@@ -233,14 +233,23 @@ class ClientPeerSelector extends TunnelPeerSelector {
matches.remove(ctx.routerHash());
rv.addAll(matches);
}
if (rv.size() < length) {
// not enough peers to build the requested size
// client tunnels do not use overrides
if (log.shouldWarn())
log.warn("CPS requested " + length + " got " + rv.size());
int min = settings.getLength();
int skew = settings.getLengthVariance();
if (skew < 0)
min += skew;
// not enough peers to build the minimum size
if (rv.size() < min)
return null;
}
} else {
rv = new ArrayList<Hash>(1);
}
//if (length != rv.size() && log.shouldWarn())
// log.warn("CPS requested " + length + " got " + rv.size() + ": " + DataHelper.toString(rv));
//else if (log.shouldDebug())
// log.debug("EPS result: " + DataHelper.toString(rv));
if (isInbound)
rv.add(0, ctx.routerHash());
else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment