From 32d60858da37cf6998c18005948d41795bfbbb45 Mon Sep 17 00:00:00 2001 From: zzz Date: Thu, 3 Mar 2022 13:37:28 -0500 Subject: [PATCH] NTCP: Start out reachable if SSU disabled So peers will attempt to connect --- .../net/i2p/router/transport/ntcp/NTCPTransport.java | 10 +++++++++- 1 file changed, 9 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 fa232a7ed..9f87c43c8 100644 --- a/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java +++ b/router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java @@ -852,6 +852,7 @@ public class NTCPTransport extends TransportImpl { boolean isFixedOrForceFirewalled = _context.getProperty(PROP_I2NP_NTCP_AUTO_IP, "true") .toLowerCase(Locale.US).equals("false"); RouterAddress myAddress = bindAddress(port); + boolean ssuDisabled = !_context.getBooleanPropertyDefaultTrue(TransportManager.PROP_ENABLE_UDP); if (myAddress != null) { // fixed interface, or bound to the specified host replaceAddress(myAddress); @@ -867,7 +868,7 @@ public class NTCPTransport extends TransportImpl { boolean skipv6 = false; for (InetAddress ia : addrs) { boolean ipv6 = ia instanceof Inet6Address; - if ((ipv6 && (isIPv6Firewalled() || _context.getBooleanProperty(PROP_IPV6_FIREWALLED))) || + if ((ipv6 && (isIPv6Firewalled() || (_context.getBooleanProperty(PROP_IPV6_FIREWALLED) && !ssuDisabled))) || (!ipv6 && isIPv4Firewalled())) { if (ipv6) skipv6 = true; @@ -897,6 +898,13 @@ public class NTCPTransport extends TransportImpl { } else { setOutboundNTCP2Address(); } + if (ssuDisabled) { + // Since we don't have peer testing, start out reachable, + // so peers will attempt to connect to us + long now = _context.clock().now(); + _lastInboundIPv4 = now; + _lastInboundIPv6 = now; + } // TransportManager.startListening() calls router.rebuildRouterInfo() }