shitlist the old idents of peers who change idents
be sure to fire any onFail jobs if we aren't going to pass a message off (duh) take clock skew into account when determining whether a message is expired (duh^2)
This commit is contained in:
@ -19,6 +19,7 @@ import net.i2p.router.JobImpl;
|
|||||||
import net.i2p.router.MessageSelector;
|
import net.i2p.router.MessageSelector;
|
||||||
import net.i2p.router.OutNetMessage;
|
import net.i2p.router.OutNetMessage;
|
||||||
import net.i2p.router.ReplyJob;
|
import net.i2p.router.ReplyJob;
|
||||||
|
import net.i2p.router.Router;
|
||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
@ -75,10 +76,12 @@ public class SendMessageDirectJob extends JobImpl {
|
|||||||
+ " [expiring in " + (_expiration-now) + "]", getAddedBy());
|
+ " [expiring in " + (_expiration-now) + "]", getAddedBy());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_expiration < now) {
|
if (_expiration < now - Router.CLOCK_FUDGE_FACTOR) {
|
||||||
if (_log.shouldLog(Log.ERROR))
|
if (_log.shouldLog(Log.ERROR))
|
||||||
_log.error("Timed out sending message " + _message + " directly (expiration = "
|
_log.error("Timed out sending message " + _message + " directly (expiration = "
|
||||||
+ new Date(_expiration) + ") to " + _targetHash.toBase64(), getAddedBy());
|
+ new Date(_expiration) + ") to " + _targetHash.toBase64(), getAddedBy());
|
||||||
|
if (_onFail != null)
|
||||||
|
getContext().jobQueue().addJob(_onFail);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_router != null) {
|
if (_router != null) {
|
||||||
@ -104,6 +107,8 @@ public class SendMessageDirectJob extends JobImpl {
|
|||||||
_log.error("Unable to find the router to send to: " + _targetHash
|
_log.error("Unable to find the router to send to: " + _targetHash
|
||||||
+ " after searching for " + (getContext().clock().now()-_searchOn)
|
+ " after searching for " + (getContext().clock().now()-_searchOn)
|
||||||
+ "ms, message: " + _message, getAddedBy());
|
+ "ms, message: " + _message, getAddedBy());
|
||||||
|
if (_onFail != null)
|
||||||
|
getContext().jobQueue().addJob(_onFail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@ import net.i2p.router.MessageReceptionInfo;
|
|||||||
import net.i2p.router.MessageSelector;
|
import net.i2p.router.MessageSelector;
|
||||||
import net.i2p.router.OutNetMessage;
|
import net.i2p.router.OutNetMessage;
|
||||||
import net.i2p.router.ReplyJob;
|
import net.i2p.router.ReplyJob;
|
||||||
|
import net.i2p.router.Router;
|
||||||
import net.i2p.router.RouterContext;
|
import net.i2p.router.RouterContext;
|
||||||
import net.i2p.router.TunnelInfo;
|
import net.i2p.router.TunnelInfo;
|
||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
@ -97,6 +98,8 @@ public class SendTunnelMessageJob extends JobImpl {
|
|||||||
if (_log.shouldLog(Log.ERROR))
|
if (_log.shouldLog(Log.ERROR))
|
||||||
_log.error("Someone br0ke us. where is this message supposed to go again?",
|
_log.error("Someone br0ke us. where is this message supposed to go again?",
|
||||||
getAddedBy());
|
getAddedBy());
|
||||||
|
if (_onFailure != null)
|
||||||
|
getContext().jobQueue().addJob(_onFailure);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
forwardToGateway();
|
forwardToGateway();
|
||||||
@ -145,9 +148,13 @@ public class SendTunnelMessageJob extends JobImpl {
|
|||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
if (_log.shouldLog(Log.ERROR))
|
if (_log.shouldLog(Log.ERROR))
|
||||||
_log.error("Error writing out the tunnel message to send to the tunnel", ioe);
|
_log.error("Error writing out the tunnel message to send to the tunnel", ioe);
|
||||||
|
if (_onFailure != null)
|
||||||
|
getContext().jobQueue().addJob(_onFailure);
|
||||||
} catch (DataFormatException dfe) {
|
} catch (DataFormatException dfe) {
|
||||||
if (_log.shouldLog(Log.ERROR))
|
if (_log.shouldLog(Log.ERROR))
|
||||||
_log.error("Error writing out the tunnel message to send to the tunnel", dfe);
|
_log.error("Error writing out the tunnel message to send to the tunnel", dfe);
|
||||||
|
if (_onFailure != null)
|
||||||
|
getContext().jobQueue().addJob(_onFailure);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -179,7 +186,7 @@ public class SendTunnelMessageJob extends JobImpl {
|
|||||||
_log.debug("Tunnel message created: " + msg + " out of encrypted message: "
|
_log.debug("Tunnel message created: " + msg + " out of encrypted message: "
|
||||||
+ _message);
|
+ _message);
|
||||||
long now = getContext().clock().now();
|
long now = getContext().clock().now();
|
||||||
if (_expiration < now) {
|
if (_expiration < now - Router.CLOCK_FUDGE_FACTOR) {
|
||||||
if (_log.shouldLog(Log.ERROR))
|
if (_log.shouldLog(Log.ERROR))
|
||||||
_log.error("We are the gateway to " + info.getTunnelId().getTunnelId()
|
_log.error("We are the gateway to " + info.getTunnelId().getTunnelId()
|
||||||
+ " and the message " + msg.getUniqueId() + " is valid, but it has timed out ("
|
+ " and the message " + msg.getUniqueId() + " is valid, but it has timed out ("
|
||||||
@ -468,7 +475,7 @@ public class SendTunnelMessageJob extends JobImpl {
|
|||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldLog(Log.WARN))
|
||||||
_log.warn("Why are we trying to send a " + _message.getClass().getName()
|
_log.warn("Why are we trying to send a " + _message.getClass().getName()
|
||||||
+ " message with " + (_expiration-now) + "ms left?", getAddedBy());
|
+ " message with " + (_expiration-now) + "ms left?", getAddedBy());
|
||||||
if (timeLeft < 0) {
|
if (timeLeft + Router.CLOCK_FUDGE_FACTOR < 0) {
|
||||||
_log.error("Timed out honoring request to send a " + _message.getClass().getName()
|
_log.error("Timed out honoring request to send a " + _message.getClass().getName()
|
||||||
+ " message remotely [" + _message.getUniqueId() + "] expired "
|
+ " message remotely [" + _message.getUniqueId() + "] expired "
|
||||||
+ (0-timeLeft) + "ms ago");
|
+ (0-timeLeft) + "ms ago");
|
||||||
|
@ -444,6 +444,7 @@ public class TCPTransport extends TransportImpl {
|
|||||||
con.closeConnection();
|
con.closeConnection();
|
||||||
// remove the old ref, since they likely just created a new identity
|
// remove the old ref, since they likely just created a new identity
|
||||||
_context.netDb().fail(target.getIdentity().getHash());
|
_context.netDb().fail(target.getIdentity().getHash());
|
||||||
|
_context.shitlist().shitlistRouter(target.getIdentity().getHash());
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
|
Reference in New Issue
Block a user