forked from I2P_Developers/i2p.i2p
* I2CP: Fix NPE caused by null session options (seen in i2pbote)
This commit is contained in:
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -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 {
|
||||
@@ -531,6 +532,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; }
|
||||
|
||||
|
@@ -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 } );
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user