From 2f5f91a0849c298b62735ab8e6b413bd2f56422f Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Wed, 8 Apr 2015 11:52:02 +0000 Subject: [PATCH] log tweaks --- .../i2p/i2ptunnel/I2PTunnelClientBase.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java index 972818cdd9..a2c408973d 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelClientBase.java @@ -420,31 +420,33 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna * @since 0.9.20 */ private void connectManager() { - // shadows instance _log - Log _log = getTunnel().getContext().logManager().getLog(I2PTunnelClientBase.class); - Logging log = this.l; int retries = 0; while (sockMgr.getSession().isClosed()) { try { sockMgr.getSession().connect(); } catch (I2PSessionException ise) { + // shadows instance _log + Log _log = getTunnel().getContext().logManager().getLog(I2PTunnelClientBase.class); + Logging log = this.l; // try to make this error sensible as it will happen... String portNum = getTunnel().port; if (portNum == null) portNum = "7654"; - String msg = "Unable to connect to the router at " + getTunnel().host + ':' + portNum + + String msg; + if (getTunnel().getContext().isRouterContext()) + msg = "Unable to connect to the router at " + getTunnel().host + ':' + portNum + " and build tunnels for the client"; + else + msg = "Unable to build tunnels for the client"; if (++retries < MAX_RETRIES) { if (log != null) log.log(msg + ", retrying in " + (RETRY_DELAY / 1000) + " seconds"); - _log.error(msg + ", retrying in " + (RETRY_DELAY / 1000) + " seconds"); + _log.error(msg + ", retrying in " + (RETRY_DELAY / 1000) + " seconds", ise); } else { if (log != null) log.log(msg + ", giving up"); - _log.log(Log.CRIT, msg + ", giving up"); - // not clear if callers can handle null - //return null; - throw new IllegalArgumentException(msg); + _log.log(Log.CRIT, msg + ", giving up", ise); + throw new IllegalArgumentException(msg, ise); } try { Thread.sleep(RETRY_DELAY); } catch (InterruptedException ie) {} } -- GitLab