From a0822a6b7129aca3999a354747f0bf3a0529f8a6 Mon Sep 17 00:00:00 2001 From: zzz Date: Fri, 23 Oct 2020 16:09:15 +0000 Subject: [PATCH] NTCP2: Reduce min downtime for rekeying if hidden --- .../java/src/net/i2p/router/transport/ntcp/NTCPTransport.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java index b8bc674fd8..e08bfeb177 100644 --- a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java +++ b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java @@ -137,6 +137,7 @@ public class NTCPTransport extends TransportImpl { private static final int NTCP2_IV_LEN = OutboundNTCP2State.IV_SIZE; private static final int NTCP2_KEY_LEN = OutboundNTCP2State.KEY_SIZE; private static final long MIN_DOWNTIME_TO_REKEY = 30*24*60*60*1000L; + private static final long MIN_DOWNTIME_TO_REKEY_HIDDEN = 24*60*60*1000L; private final boolean _enableNTCP1; private final boolean _enableNTCP2; private final byte[] _ntcp2StaticPubkey; @@ -252,7 +253,8 @@ public class NTCPTransport extends TransportImpl { String b64IV = null; String s = null; // try to determine if we've been down for 30 days or more - boolean shouldRekey = _context.getEstimatedDowntime() >= MIN_DOWNTIME_TO_REKEY; + long minDowntime = _context.router().isHidden() ? MIN_DOWNTIME_TO_REKEY_HIDDEN : MIN_DOWNTIME_TO_REKEY; + boolean shouldRekey = _context.getEstimatedDowntime() >= minDowntime; if (!shouldRekey) { s = ctx.getProperty(PROP_NTCP2_SP); if (s != null) {