I2CP: Allow larger client clock skew (ticket #1503),

better error message to client
javadocs
This commit is contained in:
zzz
2015-04-01 12:50:51 +00:00
parent 20197fc3ec
commit 2ef615a3f7
5 changed files with 30 additions and 5 deletions

View File

@@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 14;
public final static long BUILD = 15;
/** for example "-test" */
public final static String EXTRA = "-rc";

View File

@@ -12,6 +12,7 @@ import java.util.Properties;
import net.i2p.CoreVersion;
import net.i2p.crypto.SigType;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.data.Hash;
import net.i2p.data.Payload;
@@ -213,6 +214,15 @@ class ClientMessageEventListener implements I2CPMessageReader.I2CPMessageEventLi
if (stype == null || !stype.isAvailable()) {
_log.error("Client requested unsupported signature type " + itype);
_runner.disconnectClient("Unsupported signature type " + itype);
} else if (in.tooOld()) {
long skew = _context.clock().now() - in.getCreationDate().getTime();
String msg = "Create session message client clock skew? ";
if (skew >= 0)
msg += DataHelper.formatDuration(skew) + " in the past";
else
msg += DataHelper.formatDuration(0 - skew) + " in the future";
_log.error(msg);
_runner.disconnectClient(msg);
} else {
_log.error("Signature verification failed on a create session message");
_runner.disconnectClient("Invalid signature on CreateSessionMessage");

View File

@@ -29,7 +29,7 @@ class LeaseRequestState {
private boolean _successful;
/**
* @param expiration absolute time
* @param expiration absolute time, when the request expires (not when the LS expires)
*/
public LeaseRequestState(Job onGranted, Job onFailed, long expiration, LeaseSet requested) {
_onGranted = onGranted;