forked from I2P_Developers/i2p.i2p
* Tunnels: Set default priorities for tunnels (ticket #719)
Exploratory: +30 IRC: +15 HTTP Proxy: +10 I2PSnark: -10
This commit is contained in:
@ -67,6 +67,7 @@ public class OutNetMessage implements CDPQEntry {
|
||||
public static final int PRIORITY_MY_BUILD_REQUEST = 500;
|
||||
public static final int PRIORITY_MY_NETDB_LOOKUP = 500;
|
||||
public static final int PRIORITY_MY_NETDB_STORE = 460;
|
||||
public static final int PRIORITY_EXPLORATORY = 455;
|
||||
/** may be adjusted +/- 25 for outbound traffic */
|
||||
public static final int PRIORITY_MY_DATA = 425;
|
||||
public static final int PRIORITY_MY_NETDB_STORE_LOW = 300;
|
||||
@ -387,6 +388,7 @@ public class OutNetMessage implements CDPQEntry {
|
||||
buf.append(getMessageType());
|
||||
}
|
||||
buf.append(" expiring on ").append(new Date(_expiration));
|
||||
buf.append(" priority ").append(_priority);
|
||||
if (_failedTransports != null)
|
||||
buf.append(" failed delivery on transports ").append(_failedTransports);
|
||||
if (_target == null)
|
||||
|
@ -40,11 +40,7 @@ public class OutNetMessagePool {
|
||||
}
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Adding outbound message to "
|
||||
+ msg.getTarget().getIdentity().getHash().toBase64().substring(0,6)
|
||||
+ " with id " + msg.getMessage().getUniqueId()
|
||||
+ " expiring on " + msg.getMessage().getMessageExpiration()
|
||||
+ " of type " + msg.getMessageType());
|
||||
_log.debug("Adding " + msg);
|
||||
|
||||
MessageSelector selector = msg.getReplySelector();
|
||||
if (selector != null) {
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 7;
|
||||
public final static long BUILD = 8;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
@ -59,6 +59,7 @@ public class TunnelPoolSettings {
|
||||
public static final int DEFAULT_IP_RESTRICTION = 2; // class B (/16)
|
||||
private static final int MIN_PRIORITY = -25;
|
||||
private static final int MAX_PRIORITY = 25;
|
||||
private static final int EXPLORATORY_PRIORITY = 30;
|
||||
|
||||
public TunnelPoolSettings(boolean isExploratory, boolean isInbound) {
|
||||
_isExploratory = isExploratory;
|
||||
@ -74,6 +75,8 @@ public class TunnelPoolSettings {
|
||||
_IPRestriction = DEFAULT_IP_RESTRICTION;
|
||||
_unknownOptions = new Properties();
|
||||
_randomKey = generateRandomKey();
|
||||
if (_isExploratory && !_isInbound)
|
||||
_priority = EXPLORATORY_PRIORITY;
|
||||
}
|
||||
|
||||
/** how many tunnels should be available at all times */
|
||||
@ -168,7 +171,7 @@ public class TunnelPoolSettings {
|
||||
|
||||
/**
|
||||
* Outbound message priority - for outbound tunnels only
|
||||
* @return -25 to +25, default 0
|
||||
* @return -25 to +30, default 30 for outbound exploratory and 0 for others
|
||||
* @since 0.9.4
|
||||
*/
|
||||
public int getPriority() { return _priority; }
|
||||
@ -198,9 +201,11 @@ public class TunnelPoolSettings {
|
||||
_destinationNickname = value;
|
||||
else if (name.equalsIgnoreCase(prefix + PROP_IP_RESTRICTION))
|
||||
_IPRestriction = getInt(value, DEFAULT_IP_RESTRICTION);
|
||||
else if ((!_isInbound) && name.equalsIgnoreCase(prefix + PROP_PRIORITY))
|
||||
_priority = Math.min(MAX_PRIORITY, Math.max(MIN_PRIORITY, getInt(value, 0)));
|
||||
else
|
||||
else if ((!_isInbound) && name.equalsIgnoreCase(prefix + PROP_PRIORITY)) {
|
||||
int def = _isExploratory ? EXPLORATORY_PRIORITY : 0;
|
||||
int max = _isExploratory ? EXPLORATORY_PRIORITY : MAX_PRIORITY;
|
||||
_priority = Math.min(max, Math.max(MIN_PRIORITY, getInt(value, def)));
|
||||
} else
|
||||
_unknownOptions.setProperty(name.substring((prefix != null ? prefix.length() : 0)), value);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user