forked from I2P_Developers/i2p.i2p
Router: Misc. debug fixes
- StatisticsManager fix for null router in unit tests - Debug toString() enhancements - Dest hash logs in b32 - Javadoc fix
This commit is contained in:
@ -1192,8 +1192,6 @@ public class Blocklist {
|
||||
*
|
||||
* Public for console only, not a public API
|
||||
*
|
||||
* @param max maximum entries to return
|
||||
* @return sorted
|
||||
* @since 0.9.48
|
||||
*/
|
||||
public synchronized int getBlocklistSize() {
|
||||
|
@ -47,7 +47,9 @@ public class StatisticsManager {
|
||||
_fmt = new DecimalFormat("###,##0.00", new DecimalFormatSymbols(Locale.UK));
|
||||
_pct = new DecimalFormat("#0.00%", new DecimalFormatSymbols(Locale.UK));
|
||||
_log = context.logManager().getLog(StatisticsManager.class);
|
||||
_networkID = Integer.toString(context.router().getNetworkID());
|
||||
// null for some tests
|
||||
Router r = context.router();
|
||||
_networkID = r != null ? Integer.toString(r.getNetworkID()) : "2";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -582,7 +582,7 @@ class ClientManager {
|
||||
} else {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Cannot request the lease set, as we can't find a client runner for "
|
||||
+ dest + ". disconnected?");
|
||||
+ dest.toBase32() + ". disconnected?");
|
||||
}
|
||||
}
|
||||
|
||||
@ -677,12 +677,12 @@ class ClientManager {
|
||||
if (runner != null) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Delivering status " + status + " to "
|
||||
+ fromDest.calculateHash() + " for message " + id);
|
||||
+ fromDest.toBase32() + " for message " + id);
|
||||
runner.updateMessageDeliveryStatus(fromDest, id, messageNonce, status);
|
||||
} else {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Cannot deliver status " + status + " to "
|
||||
+ fromDest.calculateHash() + " for message " + id);
|
||||
+ fromDest.toBase32() + " for message " + id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -799,7 +799,7 @@ class ClientManager {
|
||||
// we should pool these somewhere...
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Message received but we don't have a connection to "
|
||||
+ dest + "/" + _msg.getDestinationHash()
|
||||
+ dest + "/" + _msg.getDestinationHash().toBase32()
|
||||
+ " currently. DROPPED", new Exception());
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ class MessageReceivedJob extends JobImpl {
|
||||
}
|
||||
return true;
|
||||
} catch (I2CPMessageException ime) {
|
||||
String msg = "Error sending data to client " + _runner.getDestHash();
|
||||
String msg = "Error sending data to client " + _runner.getDestHash().toBase32();
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg, ime);
|
||||
else
|
||||
@ -94,7 +94,7 @@ class MessageReceivedJob extends JobImpl {
|
||||
SessionId sid = _runner.getSessionId(_toDest.calculateHash());
|
||||
if (sid == null) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("No session for " + _toDest.calculateHash());
|
||||
_log.warn("No session for " + _toDest.toBase32());
|
||||
return;
|
||||
}
|
||||
msg.setSessionId(sid.getSessionId());
|
||||
@ -115,7 +115,7 @@ class MessageReceivedJob extends JobImpl {
|
||||
SessionId sid = _runner.getSessionId(_toDest.calculateHash());
|
||||
if (sid == null) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("No session for " + _toDest.calculateHash());
|
||||
_log.warn("No session for " + _toDest.toBase32());
|
||||
return;
|
||||
}
|
||||
msg.setSessionId(sid.getSessionId());
|
||||
|
@ -85,7 +85,8 @@ class SessionKeyAndNonce extends SessionKey {
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder(64);
|
||||
buf.append("[SessionKeyAndNonce: ");
|
||||
buf.append(toBase64());
|
||||
if (_data != null)
|
||||
buf.append(toBase64());
|
||||
buf.append(_state != null ? " NSR" : " ES");
|
||||
buf.append(" nonce: ").append(_nonce);
|
||||
buf.append(']');
|
||||
|
@ -9,6 +9,7 @@ package net.i2p.router.message;
|
||||
*/
|
||||
|
||||
import net.i2p.data.Certificate;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.i2np.GarlicClove;
|
||||
|
||||
/**
|
||||
@ -47,15 +48,21 @@ public class CloveSet {
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder(128);
|
||||
buf.append("{");
|
||||
buf.append("CloveSet: id ").append(_msgId)
|
||||
.append(' ').append(_cert)
|
||||
.append(" expires " ).append(DataHelper.formatTime(_expiration))
|
||||
.append(" cloves: " ).append(_cloves.length)
|
||||
.append(" {");
|
||||
for (int i = 0; i < _cloves.length; i++) {
|
||||
GarlicClove clove = _cloves[i];
|
||||
if (clove.getData() != null)
|
||||
buf.append(clove.getData().getClass().getName()).append(", ");
|
||||
buf.append(clove.getData().getClass().getSimpleName());
|
||||
else
|
||||
buf.append("[null clove], ");
|
||||
buf.append("[null clove]");
|
||||
if (i < _cloves.length - 1)
|
||||
buf.append(", ");
|
||||
}
|
||||
buf.append("}");
|
||||
buf.append('}');
|
||||
return buf.toString();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user