SSU: When a IPv6 peer connects, trigger a IPv6 peer test, not a IPv4 one

Require two consecutive peer test results for some state transitions,
to prevent frequent transitions to firewalled and back
This commit is contained in:
zzz
2017-03-31 12:28:31 +00:00
parent b810b79a44
commit c06e320f99
3 changed files with 39 additions and 3 deletions

View File

@ -1,5 +1,17 @@
2017-03-31 zzz
* SSU:
- When a IPv6 peer connects, trigger a IPv6 peer test, not a IPv4 one
- Require two consecutive peer test results for some state transitions,
to prevent frequent transitions to firewalled and back
2017-03-29 zzz
* SSU: Refactor PeerTestEvent out of UDPTransport
* Throttle: Reduce threshold for probabalistic throttling
on slow platforms (ticket #1964)
2017-03-27 zzz 2017-03-27 zzz
* Blockfile: Include authentication strings in exports * Blockfile: Include authentication strings in exports
* Build: Suppress JarScanner warning during Debian build (ticket #1975)
* Debian: Add missing addressbook.jar to package (ticket #1973) * Debian: Add missing addressbook.jar to package (ticket #1973)
* SusiDNS: Add addressbook.jar to classpath, don't fail * SusiDNS: Add addressbook.jar to classpath, don't fail
to start if it's still not found (ticket #1973) to start if it's still not found (ticket #1973)

View File

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

View File

@ -81,6 +81,8 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
private final PeerTestEvent _testEvent; private final PeerTestEvent _testEvent;
private final PacketBuilder _destroyBuilder; private final PacketBuilder _destroyBuilder;
private Status _reachabilityStatus; private Status _reachabilityStatus;
private Status _reachabilityStatusPending;
// only for logging, to be removed
private long _reachabilityStatusLastUpdated; private long _reachabilityStatusLastUpdated;
private int _reachabilityStatusUnchanged; private int _reachabilityStatusUnchanged;
private long _introducersSelectedOn; private long _introducersSelectedOn;
@ -267,6 +269,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
_testManager = new PeerTestManager(_context, this); _testManager = new PeerTestManager(_context, this);
_testEvent = new PeerTestEvent(_context, this, _testManager); _testEvent = new PeerTestEvent(_context, this, _testManager);
_reachabilityStatus = Status.UNKNOWN; _reachabilityStatus = Status.UNKNOWN;
_reachabilityStatusPending = Status.OK;
_introManager = new IntroductionManager(_context, this); _introManager = new IntroductionManager(_context, this);
_introducersSelectedOn = -1; _introducersSelectedOn = -1;
_lastInboundReceivedOn = -1; _lastInboundReceivedOn = -1;
@ -1345,8 +1348,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
status != Status.IPV4_DISABLED_IPV6_FIREWALLED && status != Status.IPV4_DISABLED_IPV6_FIREWALLED &&
status != Status.DISCONNECTED && status != Status.DISCONNECTED &&
_reachabilityStatusUnchanged < 7) { _reachabilityStatusUnchanged < 7) {
// IPv4 only for now _testEvent.forceRunSoon(peer.isIPv6());
_testEvent.forceRunSoon(false);
} }
} }
return true; return true;
@ -3155,6 +3157,27 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
} }
if (status != old) { if (status != old) {
// for the following transitions ONLY, require two in a row
// to prevent thrashing
if ((old == Status.OK && (status == Status.DIFFERENT ||
status == Status.REJECT_UNSOLICITED ||
status == Status.IPV4_FIREWALLED_IPV6_OK ||
status == Status.IPV4_SNAT_IPV6_OK ||
status == Status.IPV4_OK_IPV6_FIREWALLED)) ||
(status == Status.OK && (old == Status.DIFFERENT ||
old == Status.REJECT_UNSOLICITED ||
old == Status.IPV4_FIREWALLED_IPV6_OK ||
old == Status.IPV4_SNAT_IPV6_OK ||
old == Status.IPV4_OK_IPV6_FIREWALLED))) {
if (status != _reachabilityStatusPending) {
if (_log.shouldLog(Log.WARN))
_log.warn("Old status: " + old + " status pending confirmation: " + status +
" Caused by update: " + newStatus);
_reachabilityStatusPending = status;
_testEvent.forceRunSoon(isIPv6);
return;
}
}
_reachabilityStatusUnchanged = 0; _reachabilityStatusUnchanged = 0;
long now = _context.clock().now(); long now = _context.clock().now();
_reachabilityStatusLastUpdated = now; _reachabilityStatusLastUpdated = now;
@ -3162,6 +3185,7 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
} else { } else {
_reachabilityStatusUnchanged++; _reachabilityStatusUnchanged++;
} }
_reachabilityStatusPending = status;
} }
if (status != old) { if (status != old) {
if (_log.shouldLog(Log.WARN)) if (_log.shouldLog(Log.WARN))