From 0448537509e9dac7a31eb441df544f4de091986c Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Fri, 5 Oct 2012 13:38:27 +0000 Subject: [PATCH] make inbound and exploratory settings final --- .../java/src/net/i2p/router/ClientTunnelSettings.java | 8 ++------ router/java/src/net/i2p/router/TunnelPoolSettings.java | 10 +++++----- .../net/i2p/router/tunnel/pool/TunnelPoolManager.java | 8 ++------ 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/router/java/src/net/i2p/router/ClientTunnelSettings.java b/router/java/src/net/i2p/router/ClientTunnelSettings.java index cc8c74e6cc..efed48a9d7 100644 --- a/router/java/src/net/i2p/router/ClientTunnelSettings.java +++ b/router/java/src/net/i2p/router/ClientTunnelSettings.java @@ -20,12 +20,8 @@ public class ClientTunnelSettings { private TunnelPoolSettings _outboundSettings; public ClientTunnelSettings() { - _inboundSettings = new TunnelPoolSettings(); - _inboundSettings.setIsInbound(true); - _inboundSettings.setIsExploratory(false); - _outboundSettings = new TunnelPoolSettings(); - _outboundSettings.setIsInbound(false); - _outboundSettings.setIsExploratory(false); + _inboundSettings = new TunnelPoolSettings(false, true); + _outboundSettings = new TunnelPoolSettings(false, false); } public TunnelPoolSettings getInboundSettings() { return _inboundSettings; } diff --git a/router/java/src/net/i2p/router/TunnelPoolSettings.java b/router/java/src/net/i2p/router/TunnelPoolSettings.java index 658e644f84..ff85978822 100644 --- a/router/java/src/net/i2p/router/TunnelPoolSettings.java +++ b/router/java/src/net/i2p/router/TunnelPoolSettings.java @@ -21,8 +21,8 @@ public class TunnelPoolSettings { private int _length; private int _lengthVariance; private int _lengthOverride; - private boolean _isInbound; - private boolean _isExploratory; + private final boolean _isInbound; + private final boolean _isExploratory; private boolean _allowZeroHop; private int _IPRestriction; private final Properties _unknownOptions; @@ -54,7 +54,9 @@ public class TunnelPoolSettings { public static final boolean DEFAULT_ALLOW_ZERO_HOP = true; public static final int DEFAULT_IP_RESTRICTION = 2; // class B (/16) - public TunnelPoolSettings() { + public TunnelPoolSettings(boolean isExploratory, boolean isInbound) { + _isExploratory = isExploratory; + _isInbound = isInbound; _quantity = DEFAULT_QUANTITY; _backupQuantity = DEFAULT_BACKUP_QUANTITY; // _rebuildPeriod = DEFAULT_REBUILD_PERIOD; @@ -130,11 +132,9 @@ public class TunnelPoolSettings { /** is this an inbound tunnel? */ public boolean isInbound() { return _isInbound; } - public void setIsInbound(boolean isInbound) { _isInbound = isInbound; } /** is this an exploratory tunnel (or a client tunnel) */ public boolean isExploratory() { return _isExploratory; } - public void setIsExploratory(boolean isExploratory) { _isExploratory = isExploratory; } // Duration is hardcoded //public int getDuration() { return _duration; } diff --git a/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java b/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java index 42f7b189bd..1b6c424eca 100644 --- a/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java +++ b/router/java/src/net/i2p/router/tunnel/pool/TunnelPoolManager.java @@ -64,13 +64,9 @@ public class TunnelPoolManager implements TunnelManagerFacade { _clientPeerSelector = new ClientPeerSelector(ctx); ExploratoryPeerSelector selector = new ExploratoryPeerSelector(_context); - TunnelPoolSettings inboundSettings = new TunnelPoolSettings(); - inboundSettings.setIsExploratory(true); - inboundSettings.setIsInbound(true); + TunnelPoolSettings inboundSettings = new TunnelPoolSettings(true, true); _inboundExploratory = new TunnelPool(_context, this, inboundSettings, selector); - TunnelPoolSettings outboundSettings = new TunnelPoolSettings(); - outboundSettings.setIsExploratory(true); - outboundSettings.setIsInbound(false); + TunnelPoolSettings outboundSettings = new TunnelPoolSettings(true, false); _outboundExploratory = new TunnelPool(_context, this, outboundSettings, selector); // threads will be started in startup() -- GitLab