if the message has expired but hasn't exceeded the fudge factor, we still need to give it some time to be processed (we receive and validate it first, and if it reaches these jobs, we should let it continue)
logging
This commit is contained in:
@ -46,12 +46,15 @@ public class SendMessageDirectJob extends JobImpl {
|
||||
}
|
||||
public SendMessageDirectJob(RouterContext ctx, I2NPMessage message, Hash toPeer, Job onSend, ReplyJob onSuccess, Job onFail, MessageSelector selector, int timeoutMs, int priority) {
|
||||
super(ctx);
|
||||
if (timeoutMs <= 0) throw new IllegalArgumentException("specify a timeout (" + timeoutMs + ")");
|
||||
_log = getContext().logManager().getLog(SendMessageDirectJob.class);
|
||||
_message = message;
|
||||
_targetHash = toPeer;
|
||||
_router = null;
|
||||
_expiration = timeoutMs + ctx.clock().now();
|
||||
if (timeoutMs <= 30) {
|
||||
_expiration = ctx.clock().now() + 30*1000;
|
||||
} else {
|
||||
_expiration = timeoutMs + ctx.clock().now();
|
||||
}
|
||||
_priority = priority;
|
||||
_searchOn = 0;
|
||||
_alreadySearched = false;
|
||||
@ -99,14 +102,14 @@ public class SendMessageDirectJob extends JobImpl {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Router not specified, so we're looking for it...");
|
||||
getContext().netDb().lookupRouterInfo(_targetHash, this, this,
|
||||
_expiration - getContext().clock().now());
|
||||
_expiration - getContext().clock().now());
|
||||
_searchOn = getContext().clock().now();
|
||||
_alreadySearched = true;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
_log.error("Unable to find the router to send to: " + _targetHash
|
||||
+ " after searching for " + (getContext().clock().now()-_searchOn)
|
||||
+ "ms, message: " + _message, getAddedBy());
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Unable to find the router to send to: " + _targetHash
|
||||
+ " after searching for " + (getContext().clock().now()-_searchOn)
|
||||
+ "ms, message: " + _message, getAddedBy());
|
||||
if (_onFail != null)
|
||||
getContext().jobQueue().addJob(_onFail);
|
||||
}
|
||||
|
@ -85,7 +85,11 @@ public class SendTunnelMessageJob extends JobImpl {
|
||||
new Exception("SendTunnel from"));
|
||||
}
|
||||
//_log.info("Send tunnel message " + msg.getClass().getName() + " to " + _destRouter + " over " + _tunnelId + " targetting tunnel " + _targetTunnelId, new Exception("SendTunnel from"));
|
||||
_expiration = getContext().clock().now() + timeoutMs;
|
||||
if (timeoutMs < 30) {
|
||||
_expiration = getContext().clock().now() + 30*1000;
|
||||
} else {
|
||||
_expiration = getContext().clock().now() + timeoutMs;
|
||||
}
|
||||
}
|
||||
|
||||
public void runJob() {
|
||||
|
@ -226,7 +226,7 @@ public abstract class TransportImpl implements Transport {
|
||||
public void messageReceived(I2NPMessage inMsg, RouterIdentity remoteIdent, Hash remoteIdentHash, long msToReceive, int bytesReceived) {
|
||||
int level = Log.INFO;
|
||||
if (msToReceive > 5000)
|
||||
level = Log.ERROR;
|
||||
level = Log.WARN;
|
||||
if (_log.shouldLog(level)) {
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
buf.append("Message received: ").append(inMsg.getClass().getName());
|
||||
|
Reference in New Issue
Block a user