forked from I2P_Developers/i2p.i2p
I2CP: Don't include lease about to expire in LS request
Better error message on attempt to sign expired LS
This commit is contained in:
@@ -544,7 +544,12 @@ public class LeaseSet2 extends LeaseSet {
|
|||||||
long pub1k = _published / 1000;
|
long pub1k = _published / 1000;
|
||||||
DataHelper.writeLong(out, 4, pub1k);
|
DataHelper.writeLong(out, 4, pub1k);
|
||||||
// Divide separately to prevent rounding errors
|
// Divide separately to prevent rounding errors
|
||||||
DataHelper.writeLong(out, 2, ((_expires / 1000) - pub1k));
|
long exp = (_expires / 1000) - pub1k;
|
||||||
|
// writeLong() will throw if we try to write a negative, so preempt it with a better message
|
||||||
|
// This will only happen on the client side for leasesets we create.
|
||||||
|
if (exp < 0)
|
||||||
|
throw new DataFormatException("Leaseset expired " + (0 - exp) + " seconds ago");
|
||||||
|
DataHelper.writeLong(out, 2, exp);
|
||||||
DataHelper.writeLong(out, 2, _flags);
|
DataHelper.writeLong(out, 2, _flags);
|
||||||
if (isOffline())
|
if (isOffline())
|
||||||
writeOfflineBytes(out);
|
writeOfflineBytes(out);
|
||||||
|
|||||||
@@ -770,7 +770,8 @@ public class TunnelPool {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
long expireAfter = _context.clock().now(); // + _settings.getRebuildPeriod();
|
// we don't want it to expire before the client signs it or the ff gets it
|
||||||
|
long expireAfter = _context.clock().now() - 10*1000;
|
||||||
|
|
||||||
TunnelInfo zeroHopTunnel = null;
|
TunnelInfo zeroHopTunnel = null;
|
||||||
Lease zeroHopLease = null;
|
Lease zeroHopLease = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user