Transport: Use NTCP for some outbound connections even before

SSU minimums are met (ticket #1835)
This commit is contained in:
zzz
2016-11-10 15:09:39 +00:00
parent 24ecc858f1
commit c3181d8561
3 changed files with 31 additions and 6 deletions

View File

@@ -1,3 +1,18 @@
2016-11-10 zzz
* Transport: Use NTCP for some outbound connections even before
SSU minimums are met (ticket #1835)
2016-11-09 zzz
* Transport: Add stats for inbound v4/v6 connections (ticket #1854)
* Tunnels: Reduce default VTBM records from 5 to 4
2016-11-08 zzz
* Build: Fix minimum Java version for Windows
* Install: Add max memory option to runplain.sh
* Crypto: Change serial number in selfsigned certs from int to long
* Router: Fix low-memory log messages for non-wrapper (ticket #1795)
* Transport: Improve IPv6 selection logic
2016-11-06 zzz
* Console: Add Java 9 log warning (ticket #1870)
* Security: Consistently log authentication failures for all interfaces

View File

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

View File

@@ -1769,13 +1769,23 @@ public class UDPTransport extends TransportImpl implements TimedWeightedPriority
// (Otherwise we only talk UDP to those that are firewalled, and we will
// never get any introducers)
int count = _peersByIdent.size();
if (alwaysPreferUDP() || count < _min_peers ||
(_haveIPv6Address && count < _min_v6_peers) ||
(introducersRequired() && _introManager.introducerCount() < MIN_INTRODUCER_POOL))
if (alwaysPreferUDP()) {
return _cachedBid[SLOW_PREFERRED_BID];
else if (preferUDP())
} else if (count < _min_peers ||
(_haveIPv6Address && count < _min_v6_peers) ||
(introducersRequired() && _introManager.introducerCount() < MIN_INTRODUCER_POOL)) {
// Even if we haven't hit our minimums, give NTCP a chance some of the time.
// This may make things work a little faster at startup
// (especially when we have an IPv6 address and the increased minimums),
// and if UDP is completely blocked we'll still have some connectivity.
// TODO After some time, decide that UDP is blocked/broken and return TRANSIENT_FAIL_BID?
if (_context.random().nextInt(4) == 0)
return _cachedBid[SLOWEST_BID];
else
return _cachedBid[SLOW_PREFERRED_BID];
} else if (preferUDP()) {
return _cachedBid[SLOW_BID];
else if (haveCapacity()) {
} else if (haveCapacity()) {
if (addr.getCost() > DEFAULT_COST)
return _cachedBid[SLOWEST_COST_BID];
else