Reseed: Better error message if no valid URLs for configuration

This commit is contained in:
zzz
2015-04-20 15:45:49 +00:00
parent 8c2636aa99
commit 935a5b573d

View File

@@ -293,10 +293,11 @@ public class Reseeder {
_checker.setError(ngettext("Reseed fetched only 1 router.", _checker.setError(ngettext("Reseed fetched only 1 router.",
"Reseed fetched only {0} routers.", total)); "Reseed fetched only {0} routers.", total));
} else { } else {
System.out.println("Reseed failed, check network connection"); if (total == 0) {
System.out.println( System.out.println("Reseed failed, check network connection");
"Ensure that nothing blocks outbound HTTP, check the logs, " + System.out.println("Ensure that nothing blocks outbound HTTP or HTTPS, check the logs, " +
"and if nothing helps, read the FAQ about reseeding manually."); "and if nothing helps, read the FAQ about reseeding manually.");
} // else < 0, no valid URLs
String old = _checker.getError(); String old = _checker.getError();
_checker.setError(_("Reseed failed.") + ' ' + _checker.setError(_("Reseed failed.") + ' ' +
_("See {0} for help.", _("See {0} for help.",
@@ -396,7 +397,7 @@ public class Reseeder {
* - Otherwise just the http randomly. * - Otherwise just the http randomly.
* *
* @param echoStatus apparently always false * @param echoStatus apparently always false
* @return count of routerinfos successfully fetched * @return count of routerinfos successfully fetched, or -1 if no valid URLs
*/ */
private int reseed(boolean echoStatus) { private int reseed(boolean echoStatus) {
List<URL> URLList = new ArrayList<URL>(); List<URL> URLList = new ArrayList<URL>();
@@ -467,6 +468,11 @@ public class Reseeder {
URLList.addAll(nonSSLList); URLList.addAll(nonSSLList);
} }
} }
if (URLList.isEmpty()) {
System.out.println("No valid reseed URLs");
_checker.setError("No valid reseed URLs");
return -1;
}
return reseed(URLList, echoStatus); return reseed(URLList, echoStatus);
} }