propagate from branch 'i2p.i2p.str4d.test' (head 190d9be59620f8c6f80e0cb2fc4d9fa839edbb4f)

to branch 'i2p.i2p' (head c884db74f90a9d1c33deca6e2fd2e29f6c1ac8fa)
This commit is contained in:
str4d
2012-08-03 21:30:29 +00:00
332 changed files with 37657 additions and 40410 deletions

View File

@@ -74,6 +74,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
protected int localPort = DEFAULT_LOCALPORT;
/**
* Warning, blocks in constructor while connecting to router and building tunnels;
* TODO move that to startRunning()
*
* @param privData Base64-encoded private key data,
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
* @throws IllegalArgumentException if the I2CP configuration is b0rked so
@@ -87,6 +90,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
}
/**
* Warning, blocks in constructor while connecting to router and building tunnels;
* TODO move that to startRunning()
*
* @param privkey file containing the private key data,
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
* @param privkeyname the name of the privKey file, not clear why we need this too
@@ -111,6 +117,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
}
/**
* Warning, blocks in constructor while connecting to router and building tunnels;
* TODO move that to startRunning()
*
* @param privData stream containing the private key data,
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
* @param privkeyname the name of the privKey file, not clear why we need this too
@@ -124,6 +133,8 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
}
/**
* Non-blocking
*
* @param sktMgr the existing socket manager
* @since 0.8.9
*/
@@ -142,6 +153,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
private static final int MAX_RETRIES = 4;
/**
* Warning, blocks while connecting to router and building tunnels;
* TODO move that to startRunning()
*
* @param privData stream containing the private key data,
* format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
* @param privkeyname the name of the privKey file, not clear why we need this too
@@ -236,6 +250,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
/**
* Start running the I2PTunnelServer.
*
* TODO: Wait to connect to router until here.
*/
public void startRunning() {
// prevent JVM exit when running outside the router

View File

@@ -156,8 +156,8 @@ public class TunnelController implements Logging {
}
String type = getType();
if ( (type == null) || (type.length() <= 0) ) {
if (_log.shouldLog(Log.WARN))
_log.warn("Cannot start the tunnel - no type specified");
if (_log.shouldLog(Log.ERROR))
_log.error("Cannot start the tunnel - no type specified");
return;
}
// Config options may have changed since instantiation, so do this again.
@@ -455,6 +455,25 @@ public class TunnelController implements Logging {
}
}
_config = props;
// Set up some per-type defaults
// This really isn't the best spot to do this but for servers in particular,
// it's hard to override settings in the subclass since the session connect
// is done in the I2PTunnelServer constructor.
String type = getType();
if (type != null) {
if (type.equals("httpserver") || type.equals("streamrserver")) {
if (!_config.containsKey("option.shouldBundleReplyInfo"))
_config.setProperty("option.shouldBundleReplyInfo", "false");
} else if (type.contains("irc") || type.equals("streamrclient")) {
// maybe a bad idea for ircclient if DCC is enabled
if (!_config.containsKey("option.crypto.tagsToSend"))
_config.setProperty("option.crypto.tagsToSend", "20");
if (!_config.containsKey("option.crypto.lowTagThreshold"))
_config.setProperty("option.crypto.lowTagThreshold", "14");
}
}
// tell i2ptunnel, who will tell the TunnelTask, who will tell the SocketManager
setSessionOptions();
if (_running && _sessions != null) {
@@ -467,6 +486,9 @@ public class TunnelController implements Logging {
}
}
/**
* @return a copy
*/
public Properties getConfig(String prefix) {
Properties rv = new Properties();
for (Map.Entry e : _config.entrySet()) {