forked from I2P_Developers/i2p.i2p
Router: GarlicMessage debug logging improvements
This commit is contained in:
@ -81,9 +81,10 @@ public class GarlicMessage extends FastI2NPMessageImpl {
|
|||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
buf.append("[GarlicMessage: ");
|
buf.append("[GarlicMessage " +
|
||||||
buf.append("Data length: ").append(getData().length).append(" bytes");
|
"ID: ").append(getUniqueId())
|
||||||
buf.append("]");
|
.append(" Data: ").append(_data.length).append(" bytes" +
|
||||||
|
"]");
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,11 +238,8 @@ public class GarlicMessageBuilder {
|
|||||||
log.debug("Building a message expiring in " + timeFromNow + "ms: " + config, new Exception("created by"));
|
log.debug("Building a message expiring in " + timeFromNow + "ms: " + config, new Exception("created by"));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
if (log.shouldDebug())
|
||||||
if (log.shouldLog(Log.DEBUG))
|
log.debug("Built ElG CloveSet (" + config.getCloveCount() + " cloves " + cloveSet.length + " bytes) in " + msg);
|
||||||
log.debug("CloveSet (" + config.getCloveCount() + " cloves) for message " + msg.getUniqueId() + " is " + cloveSet.length
|
|
||||||
+ " bytes and encrypted message data is " + encData.length + " bytes");
|
|
||||||
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,6 +263,9 @@ public class GarlicMessageBuilder {
|
|||||||
return null;
|
return null;
|
||||||
msg.setData(encData);
|
msg.setData(encData);
|
||||||
msg.setMessageExpiration(config.getExpiration());
|
msg.setMessageExpiration(config.getExpiration());
|
||||||
|
Log log = ctx.logManager().getLog(GarlicMessageBuilder.class);
|
||||||
|
if (log.shouldDebug())
|
||||||
|
log.debug("Built ECIES CloveSet (" + config.getCloveCount() + " cloves) in " + msg);
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,8 +329,7 @@ public class GarlicMessageBuilder {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (log.shouldDebug())
|
if (log.shouldDebug())
|
||||||
log.debug("CloveSet (" + config.getCloveCount() + " cloves) for message " + msg.getUniqueId()
|
log.debug("Built ECIES CloveSet (" + config.getCloveCount() + " cloves) in " + msg);
|
||||||
+ " encrypted message data is " + encData.length + " bytes");
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ public class GarlicMessageReceiver {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Not trying to decrypt a garlic routed message to a disconnected client");
|
_log.warn("Not decrypting " + message + " for disconnected " + _clientDestination.toBase32());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -99,10 +99,8 @@ public class GarlicMessageReceiver {
|
|||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.WARN)) {
|
if (_log.shouldLog(Log.WARN)) {
|
||||||
String d = (_clientDestination != null) ? _clientDestination.toBase32() : "the router";
|
String d = (_clientDestination != null) ? _clientDestination.toBase32() : "the router";
|
||||||
_log.warn("CloveMessageParser failed to decrypt the " + message.getData().length +
|
String keys = (decryptionKey2 != null) ? "both ElGamal and ECIES keys" : decryptionKey.getType().toString();
|
||||||
" byte message [" + message.getUniqueId()
|
_log.warn("Failed to decrypt " + message + " for " + d + " with " + keys);
|
||||||
+ "] for " + d + " with key " + decryptionKey.getType(),
|
|
||||||
new Exception("Decrypt garlic failed"));
|
|
||||||
}
|
}
|
||||||
_context.statManager().addRateData("crypto.garlic.decryptFail", 1);
|
_context.statManager().addRateData("crypto.garlic.decryptFail", 1);
|
||||||
_context.messageHistory().messageProcessingError(message.getUniqueId(),
|
_context.messageHistory().messageProcessingError(message.getUniqueId(),
|
||||||
|
Reference in New Issue
Block a user