diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java index 4ae4821eaf08d1a3fba462a0d24a32ed67b67ac5..b7e40f94dad004b85a805e85cfcd41f5ce7a82fa 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java @@ -489,7 +489,9 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna else msg = "Unable to connect to the router at " + getTunnel().host + ':' + portNum + " and build tunnels for the client"; - if (++retries < MAX_RETRIES) { + String exmsg = ise.getMessage(); + boolean fail = exmsg != null && exmsg.contains("session limit exceeded"); + if (!fail && ++retries < MAX_RETRIES) { if (log != null) log.log(msg + ", retrying in " + (RETRY_DELAY / 1000) + " seconds"); _log.error(msg + ", retrying in " + (RETRY_DELAY / 1000) + " seconds", ise); diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java index dab84d9e518401a1419211a3a4e47ff22be4784f..cddcef0c369c678d06b940d442fcff69937c9a7d 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelServer.java @@ -380,7 +380,9 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable { else msg = "Unable to connect to the router at " + getTunnel().host + ':' + portNum + " and build tunnels for the server at " + remoteHost.getHostAddress() + ':' + remotePort; - if (++retries < MAX_RETRIES) { + String exmsg = ise.getMessage(); + boolean fail = exmsg != null && exmsg.contains("session limit exceeded"); + if (!fail && ++retries < MAX_RETRIES) { msg += ", retrying in " + (RETRY_DELAY / 1000) + " seconds"; this.l.log(msg); _log.error(msg); diff --git a/core/java/src/net/i2p/client/impl/I2PSessionImpl.java b/core/java/src/net/i2p/client/impl/I2PSessionImpl.java index 3ceea07a74e4b011137f2b000edcb0ced0e29394..1d18b48b745b5b6c588ce3f811a98f326b93f524 100644 --- a/core/java/src/net/i2p/client/impl/I2PSessionImpl.java +++ b/core/java/src/net/i2p/client/impl/I2PSessionImpl.java @@ -835,6 +835,8 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2 msg = "Failed to bind to the router on " + _options.getProperty(PROP_DOMAIN_SOCKET) + " and build tunnels"; else msg = "Cannot connect to the router on " + _hostname + ':' + _portNum + " and build tunnels"; + if (ioe.getMessage() != null) + msg += " - " + ioe.getMessage(); throw new I2PSessionException(getPrefix() + msg, ioe); } finally { if (success) { diff --git a/router/java/src/net/i2p/router/client/ClientManager.java b/router/java/src/net/i2p/router/client/ClientManager.java index b4757d032085e1010ff78b6f0c8224e1adc8afdb..a8bc8f46ee33f945603be2c03543daf674659761 100644 --- a/router/java/src/net/i2p/router/client/ClientManager.java +++ b/router/java/src/net/i2p/router/client/ClientManager.java @@ -89,7 +89,7 @@ class ClientManager { /** 2 bytes, save 65535 for unknown */ private static final int MAX_SESSION_ID = 65534; private static final String PROP_MAX_SESSIONS = "i2cp.maxSessions"; - private static final int DEFAULT_MAX_SESSIONS = 100; + private static final int DEFAULT_MAX_SESSIONS = 50; /** 65535 */ public static final SessionId UNKNOWN_SESSION_ID = new SessionId(MAX_SESSION_ID + 1); @@ -431,6 +431,8 @@ class ClientManager { * @since 0.9.12 */ private SessionId locked_getNextSessionId() { + if (_ctx.commSystem().isDummy()) + return null; int max = Math.max(1, Math.min(2048, _ctx.getProperty(PROP_MAX_SESSIONS, DEFAULT_MAX_SESSIONS))); if (_runnerSessionIds.size() >= max) { _log.logAlways(Log.WARN, "Session refused, max is " + max + ", increase " + PROP_MAX_SESSIONS);