forked from I2P_Developers/i2p.i2p
log tweaks
This commit is contained in:
@ -420,31 +420,33 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
|
|||||||
* @since 0.9.20
|
* @since 0.9.20
|
||||||
*/
|
*/
|
||||||
private void connectManager() {
|
private void connectManager() {
|
||||||
// shadows instance _log
|
|
||||||
Log _log = getTunnel().getContext().logManager().getLog(I2PTunnelClientBase.class);
|
|
||||||
Logging log = this.l;
|
|
||||||
int retries = 0;
|
int retries = 0;
|
||||||
while (sockMgr.getSession().isClosed()) {
|
while (sockMgr.getSession().isClosed()) {
|
||||||
try {
|
try {
|
||||||
sockMgr.getSession().connect();
|
sockMgr.getSession().connect();
|
||||||
} catch (I2PSessionException ise) {
|
} 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...
|
// try to make this error sensible as it will happen...
|
||||||
String portNum = getTunnel().port;
|
String portNum = getTunnel().port;
|
||||||
if (portNum == null)
|
if (portNum == null)
|
||||||
portNum = "7654";
|
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";
|
" and build tunnels for the client";
|
||||||
|
else
|
||||||
|
msg = "Unable to build tunnels for the client";
|
||||||
if (++retries < MAX_RETRIES) {
|
if (++retries < MAX_RETRIES) {
|
||||||
if (log != null)
|
if (log != null)
|
||||||
log.log(msg + ", retrying in " + (RETRY_DELAY / 1000) + " seconds");
|
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 {
|
} else {
|
||||||
if (log != null)
|
if (log != null)
|
||||||
log.log(msg + ", giving up");
|
log.log(msg + ", giving up");
|
||||||
_log.log(Log.CRIT, msg + ", giving up");
|
_log.log(Log.CRIT, msg + ", giving up", ise);
|
||||||
// not clear if callers can handle null
|
throw new IllegalArgumentException(msg, ise);
|
||||||
//return null;
|
|
||||||
throw new IllegalArgumentException(msg);
|
|
||||||
}
|
}
|
||||||
try { Thread.sleep(RETRY_DELAY); } catch (InterruptedException ie) {}
|
try { Thread.sleep(RETRY_DELAY); } catch (InterruptedException ie) {}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user