SSU: Only advertise 'C' cap if we can really introduce

Only ask for relay tag if we don't have enough
This commit is contained in:
zzz
2021-03-03 06:13:36 -05:00
parent eecb6bef69
commit 6520f69a38
2 changed files with 5 additions and 4 deletions

View File

@@ -500,8 +500,9 @@ class EstablishmentManager {
// TODO if already we have their RI, only offer if they need it (no 'C' cap)
// if extended options, only if they asked for it
if (state.isIntroductionRequested() &&
_transport.canIntroduce() && state.getSentPort() >= 1024 &&
state.getSentIP().length == 4) {
state.getSentIP().length == 4 &&
state.getSentPort() >= 1024 &&
_transport.canIntroduce()) {
// ensure > 0
long tag = 1 + _context.random().nextLong(MAX_TAG_VALUE);
state.setSentRelayTag(tag);

View File

@@ -2491,7 +2491,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
// if we have explicit external addresses, they had better be reachable
String caps;
if (introducersRequired) {
if (introducersRequired || !canIntroduce()) {
if (_context.getProperty(PROP_TRANSPORT_CAPS, ENABLE_TRANSPORT_CAPS))
caps = CAP_TESTING_4;
else
@@ -2785,7 +2785,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
case IPV4_UNKNOWN_IPV6_OK:
case IPV4_UNKNOWN_IPV6_FIREWALLED:
case UNKNOWN:
return true;
return _introManager.introducerCount() < 2 * MIN_INTRODUCER_POOL;
default:
return !allowDirectUDP();