forked from I2P_Developers/i2p.i2p
Tunnels: getUnknownOptions() is non-null
one more TunnelId fixup
This commit is contained in:
@ -277,6 +277,9 @@ public class TunnelPoolSettings {
|
||||
*/
|
||||
public int getPriority() { return _priority; }
|
||||
|
||||
/**
|
||||
* @return non-null
|
||||
*/
|
||||
public Properties getUnknownOptions() { return _unknownOptions; }
|
||||
|
||||
/**
|
||||
|
@ -76,13 +76,13 @@ public abstract class BuildMessageGenerator {
|
||||
Hash peer = cfg.getPeer(hop);
|
||||
long recvTunnelId = -1;
|
||||
if (cfg.isInbound() || (hop > 0))
|
||||
recvTunnelId = hopConfig.getReceiveTunnel().getTunnelId();
|
||||
recvTunnelId = hopConfig.getReceiveTunnelId();
|
||||
else
|
||||
recvTunnelId = 0;
|
||||
long nextTunnelId = -1;
|
||||
Hash nextPeer = null;
|
||||
if (hop + 1 < cfg.getLength()) {
|
||||
nextTunnelId = cfg.getConfig(hop+1).getReceiveTunnel().getTunnelId();
|
||||
nextTunnelId = cfg.getConfig(hop+1).getReceiveTunnelId();
|
||||
nextPeer = cfg.getPeer(hop+1);
|
||||
} else {
|
||||
if ( (replyTunnel >= 0) && (replyRouter != null) ) {
|
||||
|
@ -47,6 +47,9 @@ class PooledTunnelCreatorConfig extends TunnelCreatorConfig {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return non-null
|
||||
*/
|
||||
@Override
|
||||
public Properties getOptions() {
|
||||
return _pool.getSettings().getUnknownOptions();
|
||||
|
@ -104,14 +104,12 @@ public abstract class TunnelPeerSelector extends ConnectChecker {
|
||||
protected boolean shouldSelectExplicit(TunnelPoolSettings settings) {
|
||||
if (settings.isExploratory()) return false;
|
||||
Properties opts = settings.getUnknownOptions();
|
||||
if (opts != null) {
|
||||
String peers = opts.getProperty("explicitPeers");
|
||||
if (peers == null)
|
||||
peers = ctx.getProperty("explicitPeers");
|
||||
// only one out of 4 times so we don't break completely if peer doesn't build one
|
||||
if (peers != null && ctx.random().nextInt(4) == 0)
|
||||
return true;
|
||||
}
|
||||
String peers = opts.getProperty("explicitPeers");
|
||||
if (peers == null)
|
||||
peers = ctx.getProperty("explicitPeers");
|
||||
// only one out of 4 times so we don't break completely if peer doesn't build one
|
||||
if (peers != null && ctx.random().nextInt(4) == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -123,8 +121,7 @@ public abstract class TunnelPeerSelector extends ConnectChecker {
|
||||
protected List<Hash> selectExplicit(TunnelPoolSettings settings, int length) {
|
||||
String peers = null;
|
||||
Properties opts = settings.getUnknownOptions();
|
||||
if (opts != null)
|
||||
peers = opts.getProperty("explicitPeers");
|
||||
peers = opts.getProperty("explicitPeers");
|
||||
|
||||
if (peers == null)
|
||||
peers = ctx.getProperty("explicitPeers");
|
||||
|
Reference in New Issue
Block a user