* removed some failsafe code that had been preventing any messages from being sent down alternate tunnels in a leaseSet [oops]

this may have unintended consequences, as we need to deal with messages received from skewed clocks, but I believe the two pathways
used here are safe (we leave the larger timeout thresholds intact for dealing with remotely generated message times)
This commit is contained in:
jrandom
2004-08-30 08:29:06 +00:00
committed by zzz
parent 93afcd5c0c
commit 49d7b568df
2 changed files with 9 additions and 15 deletions

View File

@ -50,8 +50,10 @@ public class SendMessageDirectJob extends JobImpl {
_message = message;
_targetHash = toPeer;
_router = null;
if (timeoutMs <= 30*1000) {
_expiration = ctx.clock().now() + 30*1000;
if (timeoutMs < 5*1000) {
if (_log.shouldLog(Log.WARN))
_log.warn("Very little time given [" + timeoutMs + "], resetting to 5s", new Exception("stingy bastard"));
_expiration = ctx.clock().now() + 5*1000;
} else {
_expiration = timeoutMs + ctx.clock().now();
}
@ -73,7 +75,7 @@ public class SendMessageDirectJob extends JobImpl {
public void runJob() {
long now = getContext().clock().now();
if (_expiration < now - Router.CLOCK_FUDGE_FACTOR) {
if (_expiration < now) {
if (_log.shouldLog(Log.ERROR))
_log.error("Timed out sending message " + _message + " directly (expiration = "
+ new Date(_expiration) + ") to " + _targetHash.toBase64(), getAddedBy());
@ -82,16 +84,6 @@ public class SendMessageDirectJob extends JobImpl {
return;
}
if (_expiration - 30*1000 < now) {
if (_log.shouldLog(Log.INFO))
_log.info("Soon to expire sendDirect of " + _message.getClass().getName()
+ " [expiring in " + (_expiration-now) + "]", getAddedBy());
// if its made it this far, we want to honor it, so make sure we give it
// enough time to be sent out
_expiration += 30*1000;
}
if (_router != null) {
if (_log.shouldLog(Log.DEBUG))
_log.debug("Router specified, sending");

View File

@ -85,8 +85,10 @@ 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"));
if (timeoutMs < 30*1000) {
_expiration = getContext().clock().now() + 30*1000;
if (timeoutMs < 5*1000) {
if (_log.shouldLog(Log.WARN))
_log.warn("Very little time given [" + timeoutMs + "], resetting to 5s", new Exception("stingy bastard"));
_expiration = getContext().clock().now() + 5*1000;
} else {
_expiration = getContext().clock().now() + timeoutMs;
}