propagate from branch 'i2p.i2p.zzz.test4' (head 3569f7d0608498cadafc88e87a0ad2b18c44dfb6)

to branch 'i2p.i2p' (head ddc9be27c47878e472d5b6c281cccb6094c42c9a)
This commit is contained in:
zzz
2010-11-17 16:09:19 +00:00
73 changed files with 4497 additions and 2504 deletions

View File

@@ -16,7 +16,7 @@ package net.i2p;
public class CoreVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = "0.8";
public final static String VERSION = "0.8.1";
public static void main(String args[]) {
System.out.println("I2P Core version: " + VERSION);

View File

@@ -45,7 +45,7 @@ public interface I2PClient {
* the router how to handle the new session, and to configure the end to end
* encryption.
* @param destKeyStream location from which to read the Destination, PrivateKey, and SigningPrivateKey from
* @param options set of options to configure the router with
* @param options set of options to configure the router with, if null will use System properties
* @return new session allowing a Destination to recieve all of its messages and send messages to any other Destination.
*/
public I2PSession createSession(InputStream destKeyStream, Properties options) throws I2PSessionException;

View File

@@ -67,14 +67,14 @@ class I2PClientImpl implements I2PClient {
/**
* Create a new session (though do not connect it yet)
*
* @param options set of options to configure the router with, if null will use System properties
*/
public I2PSession createSession(InputStream destKeyStream, Properties options) throws I2PSessionException {
return createSession(I2PAppContext.getGlobalContext(), destKeyStream, options);
}
/**
* Create a new session (though do not connect it yet)
*
* @param options set of options to configure the router with, if null will use System properties
*/
public I2PSession createSession(I2PAppContext context, InputStream destKeyStream, Properties options) throws I2PSessionException {
return new I2PSessionMuxedImpl(context, destKeyStream, options); // thread safe and muxed

View File

@@ -137,6 +137,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
* Create a new session, reading the Destination, PrivateKey, and SigningPrivateKey
* from the destKeyStream, and using the specified options to connect to the router
*
* @param options set of options to configure the router with, if null will use System properties
* @throws I2PSessionException if there is a problem loading the private keys or
*/
public I2PSessionImpl(I2PAppContext context, InputStream destKeyStream, Properties options) throws I2PSessionException {
@@ -543,6 +544,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
/**
* Retrieve the configuration options
* @return non-null, if insantiated with null options, this will be the System properties.
*/
Properties getOptions() { return _options; }

View File

@@ -49,6 +49,7 @@ class I2PSessionImpl2 extends I2PSessionImpl {
* Create a new session, reading the Destination, PrivateKey, and SigningPrivateKey
* from the destKeyStream, and using the specified options to connect to the router
*
* @param options set of options to configure the router with, if null will use System properties
* @throws I2PSessionException if there is a problem loading the private keys or
*/
public I2PSessionImpl2(I2PAppContext ctx, InputStream destKeyStream, Properties options) throws I2PSessionException {
@@ -56,7 +57,7 @@ class I2PSessionImpl2 extends I2PSessionImpl {
_log = ctx.logManager().getLog(I2PSessionImpl2.class);
_sendingStates = new HashSet(32);
// default is BestEffort
_noEffort = "none".equalsIgnoreCase(options.getProperty(I2PClient.PROP_RELIABILITY));
_noEffort = "none".equalsIgnoreCase(getOptions().getProperty(I2PClient.PROP_RELIABILITY));
ctx.statManager().createRateStat("i2cp.sendBestEffortTotalTime", "how long to do the full sendBestEffort call?", "i2cp", new long[] { 10*60*1000 } );
//ctx.statManager().createRateStat("i2cp.sendBestEffortStage0", "first part of sendBestEffort?", "i2cp", new long[] { 10*60*1000 } );

View File

@@ -67,6 +67,9 @@ import net.i2p.util.SimpleScheduler;
class I2PSessionMuxedImpl extends I2PSessionImpl2 implements I2PSession {
private I2PSessionDemultiplexer _demultiplexer;
/*
* @param options set of options to configure the router with, if null will use System properties
*/
public I2PSessionMuxedImpl(I2PAppContext ctx, InputStream destKeyStream, Properties options) throws I2PSessionException {
super(ctx, destKeyStream, options);
// also stored in _sessionListener but we keep it in _demultipexer

View File

@@ -67,6 +67,10 @@ class LookupDest {
}
public static void main(String args[]) {
System.out.println(lookupBase32Hash(I2PAppContext.getGlobalContext(), args[0]));
Destination dest = lookupBase32Hash(I2PAppContext.getGlobalContext(), args[0]);
if (dest == null)
System.out.println("Destination not found!");
else
System.out.println(dest.toBase64());
}
}

View File

@@ -102,7 +102,7 @@ public final class ByteCache {
public static void clearAll() {
for (ByteCache bc : _caches.values())
bc.clear();
I2PAppContext.getGlobalContext().logManager().getLog(ByteCache.class).error("WARNING: Low memory, clearing byte caches");
I2PAppContext.getGlobalContext().logManager().getLog(ByteCache.class).warn("WARNING: Low memory, clearing byte caches");
}
private Log _log;

View File

@@ -25,8 +25,7 @@ public class SecureFileOutputStream extends FileOutputStream {
}
/**
* Sets output file to mode 600 only if append = false
* (otherwise it is presumed to be 600 already)
* Sets output file to mode 600 whether append = true or false
*/
public SecureFileOutputStream(String file, boolean append) throws FileNotFoundException {
super(file, append);