forked from I2P_Developers/i2p.i2p
* OCMOSJ, ElG, Streaming: log tweaks
This commit is contained in:
@ -157,8 +157,8 @@ class MessageInputStream extends InputStream {
|
||||
*/
|
||||
public int getReadTimeout() { return _readTimeout; }
|
||||
public void setReadTimeout(int timeout) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Changing read timeout from " + _readTimeout + " to " + timeout);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Changing read timeout from " + _readTimeout + " to " + timeout);
|
||||
_readTimeout = timeout;
|
||||
}
|
||||
|
||||
@ -373,7 +373,7 @@ class MessageInputStream extends InputStream {
|
||||
}
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("available(): " + numBytes + " " + toString());
|
||||
_log.debug("available(): " + numBytes);
|
||||
|
||||
return numBytes;
|
||||
}
|
||||
|
@ -81,8 +81,8 @@ class MessageOutputStream extends OutputStream {
|
||||
}
|
||||
|
||||
public void setWriteTimeout(int ms) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Changing write timeout from " + _writeTimeout + " to " + ms);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Changing write timeout from " + _writeTimeout + " to " + ms);
|
||||
|
||||
_writeTimeout = ms;
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class ElGamalAESEngine {
|
||||
//if (_log.shouldLog(Log.DEBUG)) _log.debug("Key is known for tag " + st);
|
||||
long id = _context.random().nextLong();
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(id + ": Decrypting existing session encrypted with tag: " + st.toString() + ": key: " + key.toBase64() + ": " + data.length + " bytes: " + Base64.encode(data, 0, 64));
|
||||
_log.debug(id + ": Decrypting existing session encrypted with tag: " + st.toString() + ": key: " + key.toBase64() + ": " + data.length + " bytes " /* + Base64.encode(data, 0, 64) */ );
|
||||
|
||||
decrypted = decryptExistingSession(data, key, targetPrivateKey, foundTags, usedKey, foundKey);
|
||||
if (decrypted != null) {
|
||||
@ -410,7 +410,7 @@ public class ElGamalAESEngine {
|
||||
_context.statManager().updateFrequency("crypto.elGamalAES.encryptExistingSession");
|
||||
byte rv[] = encryptExistingSession(data, target, key, tagsForDelivery, currentTag, newKey, paddedSize);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Existing session encrypted with tag: " + currentTag.toString() + ": " + rv.length + " bytes and key: " + key.toBase64() + ": " + Base64.encode(rv, 0, 64));
|
||||
_log.debug("Existing session encrypted with tag: " + currentTag.toString() + ": " + rv.length + " bytes and key: " + key.toBase64() /* + ": " + Base64.encode(rv, 0, 64) */);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -83,7 +83,7 @@ public class GarlicMessage extends FastI2NPMessageImpl {
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("[GarlicMessage: ");
|
||||
buf.append("\n\tData length: ").append(getData().length).append(" bytes");
|
||||
buf.append("Data length: ").append(getData().length).append(" bytes");
|
||||
buf.append("]");
|
||||
return buf.toString();
|
||||
}
|
||||
|
@ -233,8 +233,8 @@ public class GarlicMessageBuilder {
|
||||
}
|
||||
|
||||
if (log.shouldLog(Log.DEBUG))
|
||||
log.debug("CloveSet size for message " + msg.getUniqueId() + " is " + cloveSet.length
|
||||
+ " and encrypted message data is " + encData.length);
|
||||
log.debug("CloveSet (" + config.getCloveCount() + " cloves) for message " + msg.getUniqueId() + " is " + cloveSet.length
|
||||
+ " bytes and encrypted message data is " + encData.length + " bytes");
|
||||
|
||||
return msg;
|
||||
}
|
||||
@ -268,7 +268,7 @@ public class GarlicMessageBuilder {
|
||||
for (int i = 0; i < config.getCloveCount(); i++) {
|
||||
GarlicConfig c = config.getClove(i);
|
||||
if (c instanceof PayloadGarlicConfig) {
|
||||
log.debug("Subclove IS a payload garlic clove");
|
||||
//log.debug("Subclove IS a payload garlic clove");
|
||||
cloves[i] = buildClove(ctx, (PayloadGarlicConfig)c);
|
||||
} else {
|
||||
log.debug("Subclove IS NOT a payload garlic clove");
|
||||
|
@ -71,13 +71,13 @@ class GarlicMessageParser {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("# cloves to read: " + numCloves);
|
||||
for (int i = 0; i < numCloves; i++) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Reading clove " + i);
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug("Reading clove " + i);
|
||||
GarlicClove clove = new GarlicClove(_context);
|
||||
offset += clove.readBytes(data, offset);
|
||||
set.addClove(clove);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("After reading clove " + i);
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug("After reading clove " + i);
|
||||
}
|
||||
//Certificate cert = new Certificate();
|
||||
//offset += cert.readBytes(data, offset);
|
||||
|
@ -88,7 +88,7 @@ class OutboundClientMessageJobHelper {
|
||||
PayloadGarlicConfig dataClove, Hash from, Destination dest, TunnelInfo replyTunnel, boolean requireAck,
|
||||
LeaseSet bundledReplyLeaseSet) {
|
||||
Log log = ctx.logManager().getLog(OutboundClientMessageJobHelper.class);
|
||||
if (log.shouldLog(Log.DEBUG))
|
||||
if (replyToken >= 0 && log.shouldLog(Log.DEBUG))
|
||||
log.debug("Reply token: " + replyToken);
|
||||
GarlicConfig config = new GarlicConfig();
|
||||
|
||||
@ -136,20 +136,17 @@ class OutboundClientMessageJobHelper {
|
||||
Log log = ctx.logManager().getLog(OutboundClientMessageJobHelper.class);
|
||||
PayloadGarlicConfig ackClove = new PayloadGarlicConfig();
|
||||
|
||||
Hash replyToTunnelRouter = null; // inbound tunnel gateway
|
||||
TunnelId replyToTunnelId = null; // tunnel id on that gateway
|
||||
|
||||
if (replyToTunnel == null) {
|
||||
if (log.shouldLog(Log.WARN))
|
||||
log.warn("Unable to send client message from " + from.toBase64()
|
||||
+ ", as there are no inbound tunnels available");
|
||||
return null;
|
||||
}
|
||||
replyToTunnelId = replyToTunnel.getReceiveTunnelId(0);
|
||||
replyToTunnelRouter = replyToTunnel.getPeer(0);
|
||||
TunnelId replyToTunnelId = replyToTunnel.getReceiveTunnelId(0); // tunnel id on that gateway
|
||||
Hash replyToTunnelRouter = replyToTunnel.getPeer(0); // inbound tunnel gateway
|
||||
if (log.shouldLog(Log.DEBUG))
|
||||
log.debug("Ack for the data message will come back along tunnel " + replyToTunnelId
|
||||
+ ":\n" + replyToTunnel);
|
||||
+ ": " + replyToTunnel);
|
||||
|
||||
DeliveryInstructions ackInstructions = new DeliveryInstructions();
|
||||
ackInstructions.setDeliveryMode(DeliveryInstructions.DELIVERY_MODE_TUNNEL);
|
||||
@ -163,8 +160,8 @@ class OutboundClientMessageJobHelper {
|
||||
DeliveryStatusMessage msg = new DeliveryStatusMessage(ctx);
|
||||
msg.setArrival(ctx.clock().now());
|
||||
msg.setMessageId(replyToken);
|
||||
if (log.shouldLog(Log.DEBUG))
|
||||
log.debug("Delivery status message key: " + replyToken + " arrival: " + msg.getArrival());
|
||||
//if (log.shouldLog(Log.DEBUG))
|
||||
// log.debug("Delivery status message key: " + replyToken + " arrival: " + msg.getArrival());
|
||||
|
||||
ackClove.setCertificate(Certificate.NULL_CERT);
|
||||
ackClove.setDeliveryInstructions(ackInstructions);
|
||||
@ -175,11 +172,11 @@ class OutboundClientMessageJobHelper {
|
||||
// defaults
|
||||
//ackClove.setRequestAck(false);
|
||||
|
||||
if (log.shouldLog(Log.DEBUG))
|
||||
log.debug("Delivery status message is targetting us ["
|
||||
+ ackClove.getRecipient().getIdentity().getHash().toBase64()
|
||||
+ "] via tunnel " + replyToTunnelId.getTunnelId() + " on "
|
||||
+ replyToTunnelRouter.toBase64());
|
||||
//if (log.shouldLog(Log.DEBUG))
|
||||
// log.debug("Delivery status message is targetting us ["
|
||||
// + ackClove.getRecipient().getIdentity().getHash().toBase64()
|
||||
// + "] via tunnel " + replyToTunnelId.getTunnelId() + " on "
|
||||
// + replyToTunnelRouter.toBase64());
|
||||
|
||||
return ackClove;
|
||||
}
|
||||
|
@ -150,8 +150,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
}
|
||||
}
|
||||
overallExpiration = timeoutMs + _start;
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(getJobId() + " Default Expiration (ms): " + timeoutMs);
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + " Default Expiration (ms): " + timeoutMs);
|
||||
}
|
||||
_overallExpiration = overallExpiration;
|
||||
}
|
||||
@ -182,9 +182,9 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
dieFatal();
|
||||
return;
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + ": Send outbound client message job beginning" +
|
||||
": preparing to search for the leaseSet for " + _toString);
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug(getJobId() + ": Send outbound client message job beginning" +
|
||||
// ": preparing to search for the leaseSet for " + _toString);
|
||||
long timeoutMs = _overallExpiration - now;
|
||||
Hash key = _to.calculateHash();
|
||||
SendJob success = new SendJob(getContext());
|
||||
@ -474,8 +474,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
dieFatal();
|
||||
return;
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + ": Clove built to " + _toString);
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug(getJobId() + ": Clove built to " + _toString);
|
||||
long msgExpiration = _overallExpiration; // getContext().clock().now() + OVERALL_TIMEOUT_MS_DEFAULT;
|
||||
GarlicMessage msg = OutboundClientMessageJobHelper.createGarlicMessage(getContext(), token,
|
||||
msgExpiration, key,
|
||||
@ -494,8 +494,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
return;
|
||||
}
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + ": send() - token expected " + token + " to " + _toString);
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug(getJobId() + ": send() - token expected " + token + " to " + _toString);
|
||||
|
||||
SendSuccessJob onReply = null;
|
||||
SendTimeoutJob onFail = null;
|
||||
@ -515,14 +515,14 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
}
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + ": Placing GarlicMessage into the new tunnel message bound for "
|
||||
_log.debug(getJobId() + ": GarlicMessage in new tunnel msg for "
|
||||
+ _toString + " at "
|
||||
+ _lease.getTunnelId() + " on "
|
||||
+ _lease.getGateway());
|
||||
|
||||
if (_outTunnel != null) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + ": Sending tunnel message out " + _outTunnel.getSendTunnelId(0) + " to "
|
||||
_log.debug(getJobId() + ": Sending msg out " + _outTunnel.getSendTunnelId(0) + " to "
|
||||
+ _toString + " at "
|
||||
+ _lease.getTunnelId() + " on "
|
||||
+ _lease.getGateway());
|
||||
@ -571,9 +571,9 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
long before = getContext().clock().now();
|
||||
getContext().tunnelDispatcher().dispatchOutbound(_msg, _outTunnel.getSendTunnelId(0), _lease.getTunnelId(), _lease.getGateway());
|
||||
long dispatchSendTime = getContext().clock().now() - before;
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(OutboundClientMessageOneShotJob.this.getJobId() +
|
||||
": Dispatching message to " + _toString + " complete");
|
||||
//if (_log.shouldLog(Log.INFO))
|
||||
// _log.info(OutboundClientMessageOneShotJob.this.getJobId() +
|
||||
// ": Dispatching message to " + _toString + " complete");
|
||||
getContext().statManager().addRateData("client.dispatchTime", getContext().clock().now() - _start, 0);
|
||||
getContext().statManager().addRateData("client.dispatchSendTime", dispatchSendTime, 0);
|
||||
}
|
||||
@ -728,8 +728,8 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
_clove = clove;
|
||||
_cloveId = _clove.getId();
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getJobId() + ": Built payload clove with id " + clove.getId());
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug(getJobId() + ": Built payload clove with id " + clove.getId());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -858,9 +858,9 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
public String getName() { return "Outbound client message send timeout"; }
|
||||
|
||||
public void runJob() {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info(OutboundClientMessageOneShotJob.this.getJobId()
|
||||
+ ": Soft timeout through the lease " + _lease);
|
||||
//if (_log.shouldLog(Log.INFO))
|
||||
// _log.info(OutboundClientMessageOneShotJob.this.getJobId()
|
||||
// + ": Soft timeout through the lease " + _lease);
|
||||
|
||||
// unused
|
||||
//_lease.setNumFailure(_lease.getNumFailure()+1);
|
||||
|
Reference in New Issue
Block a user