I2CP: Fix client notifier thread name

This commit is contained in:
zzz
2020-04-16 13:22:23 +00:00
parent 12ac06d5ba
commit b3d5accca2
2 changed files with 21 additions and 5 deletions

View File

@ -814,7 +814,7 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
+ (connected - startConnect)
+ "ms - ready to participate in the network!");
}
Thread notifier = new I2PAppThread(_availabilityNotifier, "ClientNotifier " + getPrefix(), true);
Thread notifier = new I2PAppThread(_availabilityNotifier, "ClientNotifier " + getName(), true);
notifier.start();
startIdleMonitor();
startVerifyUsage();
@ -1475,6 +1475,25 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
protected String getPrefix() {
StringBuilder buf = new StringBuilder();
buf.append('[');
getName(buf);
buf.append('(').append(_state.toString()).append(')');
buf.append("]: ");
return buf.toString();
}
/**
* @since 0.9.46
*/
protected String getName() {
StringBuilder buf = new StringBuilder();
getName(buf);
return buf.toString();
}
/**
* @since 0.9.46
*/
private void getName(StringBuilder buf) {
String s = _options.getProperty("inbound.nickname");
if (s != null)
buf.append(s);
@ -1483,9 +1502,6 @@ public abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2
SessionId id = _sessionId;
if (id != null)
buf.append(" #").append(id.getSessionId());
buf.append('(').append(_state.toString()).append(')');
buf.append("]: ");
return buf.toString();
}
/**

View File

@ -129,7 +129,7 @@ class SubSession extends I2PSessionMuxedImpl {
}
synchronized(_stateLock) {
if (_state != State.OPEN) {
Thread notifier = new I2PAppThread(_availabilityNotifier, "ClientNotifier " + getPrefix(), true);
Thread notifier = new I2PAppThread(_availabilityNotifier, "ClientNotifier " + getName(), true);
notifier.start();
changeState(State.OPEN);
}