Reseed: Require two sources minimum (ticket #1794)

This commit is contained in:
zzz
2016-05-25 13:53:21 +00:00
parent d48f70c2fe
commit 2a739f593f
3 changed files with 16 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2016-05-25 zzz
* DesktopGui: Add monochrome icons for Windows and Mac
* Reseed:
- Require two sources minimum (ticket #1794)
- Update list of sources requiring SNI
* Translations: Update English po files
2016-05-20 zzz
* DesktopGui:
- Fix systray menu redraw on Mac;

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 = 12;
public final static long BUILD = 13;
/** for example "-test" */
public final static String EXTRA = "";

View File

@ -63,6 +63,8 @@ public class Reseeder {
private static final boolean ENABLE_SU3 = true;
/** if false, use su3 only, and disable fallback reading directory index and individual dat files */
private static final boolean ENABLE_NON_SU3 = false;
private static final int MIN_RI_WANTED = 100;
private static final int MIN_RESEED_SERVERS = 2;
/**
* NOTE - URLs that are in both the standard and SSL groups must use the same hostname,
@ -241,6 +243,9 @@ public class Reseeder {
* Since Java 7 or Android 2.3 (API 9),
* which is the lowest Android we support anyway.
*
* Not guaranteed to be correct, e.g. FreeBSD:
* https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201446
*
* @since 0.9.20
*/
private static boolean isSNISupported() {
@ -524,6 +529,7 @@ public class Reseeder {
*/
private int reseed(List<URI> URLList, boolean echoStatus) {
int total = 0;
int fetched_reseed_servers = 0;
for (int i = 0; i < URLList.size() && _isRunning; i++) {
if (_context.router().gracefulShutdownInProgress()) {
System.out.println("Reseed aborted, shutdown in progress");
@ -542,8 +548,9 @@ public class Reseeder {
}
if (dl > 0) {
total += dl;
fetched_reseed_servers++;
// Don't go on to the next URL if we have enough
if (total >= 100)
if (total >= MIN_RI_WANTED && fetched_reseed_servers >= MIN_RESEED_SERVERS)
break;
// remove alternate versions if we haven't tried them yet
for (int j = i + 1; j < URLList.size(); ) {