API: Fix some client-side APIs to honor defaults in Properties;

add javadocs to specify where we do and don't (ticket #1491)
This commit is contained in:
zzz
2015-03-31 13:18:11 +00:00
parent 22c4149358
commit fadc624f7c
14 changed files with 116 additions and 39 deletions

View File

@@ -73,6 +73,9 @@ public interface I2PSocketManager {
/**
* Create a modified copy of the current options, to be used in a setDefaultOptions() call.
*
* As of 0.9.19, defaults in opts are honored.
*
* @param opts The new options, may be null
*/
public I2PSocketOptions buildOptions(Properties opts);

View File

@@ -49,6 +49,7 @@ public class I2PSocketManagerFactory {
* I2CP router on the local machine on the default port (7654).
*
* Blocks for a long time while the router builds tunnels.
* The nonblocking createDisconnectedManager() is preferred.
*
* @return the newly created socket manager, or null if there were errors
*/
@@ -61,6 +62,7 @@ public class I2PSocketManagerFactory {
* I2CP router on the local machine on the default port (7654).
*
* Blocks for a long time while the router builds tunnels.
* The nonblocking createDisconnectedManager() is preferred.
*
* @param opts Streaming and I2CP options, may be null
* @return the newly created socket manager, or null if there were errors
@@ -74,6 +76,7 @@ public class I2PSocketManagerFactory {
* I2CP router on the specified host and port.
*
* Blocks for a long time while the router builds tunnels.
* The nonblocking createDisconnectedManager() is preferred.
*
* @param host I2CP host null to use default, ignored if in router context
* @param port I2CP port <= 0 to use default, ignored if in router context
@@ -88,6 +91,7 @@ public class I2PSocketManagerFactory {
* I2CP router on the given machine reachable through the given port.
*
* Blocks for a long time while the router builds tunnels.
* The nonblocking createDisconnectedManager() is preferred.
*
* @param i2cpHost I2CP host null to use default, ignored if in router context
* @param i2cpPort I2CP port <= 0 to use default, ignored if in router context
@@ -115,6 +119,7 @@ public class I2PSocketManagerFactory {
* stream and connected to the default I2CP host and port.
*
* Blocks for a long time while the router builds tunnels.
* The nonblocking createDisconnectedManager() is preferred.
*
* @param myPrivateKeyStream private key stream, format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
* or null for a transient destination. Caller must close.
@@ -129,6 +134,7 @@ public class I2PSocketManagerFactory {
* stream and connected to the default I2CP host and port.
*
* Blocks for a long time while the router builds tunnels.
* The nonblocking createDisconnectedManager() is preferred.
*
* @param myPrivateKeyStream private key stream, format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
* or null for a transient destination. Caller must close.
@@ -145,6 +151,7 @@ public class I2PSocketManagerFactory {
* port.
*
* Blocks for a long time while the router builds tunnels.
* The nonblocking createDisconnectedManager() is preferred.
*
* @param myPrivateKeyStream private key stream, format is specified in {@link net.i2p.data.PrivateKeyFile PrivateKeyFile}
* or null for a transient destination. Caller must close.
@@ -220,11 +227,11 @@ public class I2PSocketManagerFactory {
Properties syscopy = (Properties) System.getProperties().clone();
for (Map.Entry<Object, Object> e : syscopy.entrySet()) {
String name = (String) e.getKey();
if (!opts.containsKey(name))
if (opts.getProperty(name) != null)
opts.setProperty(name, (String) e.getValue());
}
// as of 0.8.1 (I2CP default is BestEffort)
if (!opts.containsKey(I2PClient.PROP_RELIABILITY))
if (opts.getProperty(I2PClient.PROP_RELIABILITY) == null)
opts.setProperty(I2PClient.PROP_RELIABILITY, I2PClient.PROP_RELIABILITY_NONE);
if (i2cpHost != null)