Update: Disable sud/su2 updates (ticket #1709)

Add constraints for no Pack200 support and no certs
This commit is contained in:
zzz
2015-11-19 15:40:05 +00:00
parent 8d9d3fcf95
commit b59a8027bb
2 changed files with 27 additions and 15 deletions

View File

@ -225,6 +225,18 @@ class NewsFetcher extends UpdateRunner {
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg); _mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
return; return;
} }
if (!FileUtil.isPack200Supported()) {
String msg = _mgr._t("No Pack200 support in Java runtime.");
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
return;
}
if (!ConfigUpdateHandler.USE_SU3_UPDATE) {
String msg = _mgr._t("No update certificates installed.");
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
return;
}
String minRouter = args.get(MIN_VERSION_KEY); String minRouter = args.get(MIN_VERSION_KEY);
if (minRouter != null) { if (minRouter != null) {
if (VersionComparator.comp(RouterVersion.VERSION, minRouter) < 0) { if (VersionComparator.comp(RouterVersion.VERSION, minRouter) < 0) {
@ -251,7 +263,7 @@ class NewsFetcher extends UpdateRunner {
// TODO clearnet URLs, notify with HTTP_CLEARNET and/or HTTPS_CLEARNET // TODO clearnet URLs, notify with HTTP_CLEARNET and/or HTTPS_CLEARNET
Map<UpdateMethod, List<URI>> sourceMap = new HashMap<UpdateMethod, List<URI>>(4); Map<UpdateMethod, List<URI>> sourceMap = new HashMap<UpdateMethod, List<URI>>(4);
// Must do su3 first // Must do su3 first
if (ConfigUpdateHandler.USE_SU3_UPDATE) { //if (ConfigUpdateHandler.USE_SU3_UPDATE) {
sourceMap.put(HTTP, _mgr.getUpdateURLs(ROUTER_SIGNED_SU3, "", HTTP)); sourceMap.put(HTTP, _mgr.getUpdateURLs(ROUTER_SIGNED_SU3, "", HTTP));
addMethod(TORRENT, args.get(SU3_KEY), sourceMap); addMethod(TORRENT, args.get(SU3_KEY), sourceMap);
addMethod(HTTP_CLEARNET, args.get(CLEARNET_HTTP_SU3_KEY), sourceMap); addMethod(HTTP_CLEARNET, args.get(CLEARNET_HTTP_SU3_KEY), sourceMap);
@ -260,14 +272,14 @@ class NewsFetcher extends UpdateRunner {
_mgr.notifyVersionAvailable(this, _currentURI, ROUTER_SIGNED_SU3, _mgr.notifyVersionAvailable(this, _currentURI, ROUTER_SIGNED_SU3,
"", sourceMap, ver, ""); "", sourceMap, ver, "");
sourceMap.clear(); sourceMap.clear();
} //}
// now do sud/su2 // now do sud/su2 - DISABLED
sourceMap.put(HTTP, _mgr.getUpdateURLs(ROUTER_SIGNED, "", HTTP)); //sourceMap.put(HTTP, _mgr.getUpdateURLs(ROUTER_SIGNED, "", HTTP));
String key = FileUtil.isPack200Supported() ? SU2_KEY : SUD_KEY; //String key = FileUtil.isPack200Supported() ? SU2_KEY : SUD_KEY;
addMethod(TORRENT, args.get(key), sourceMap); //addMethod(TORRENT, args.get(key), sourceMap);
// notify about all sources at once // notify about all sources at once
_mgr.notifyVersionAvailable(this, _currentURI, ROUTER_SIGNED, //_mgr.notifyVersionAvailable(this, _currentURI, ROUTER_SIGNED,
"", sourceMap, ver, ""); // "", sourceMap, ver, "");
} else { } else {
if (_log.shouldLog(Log.DEBUG)) if (_log.shouldLog(Log.DEBUG))
_log.debug("Our version is current"); _log.debug("Our version is current");
@ -414,9 +426,8 @@ class NewsFetcher extends UpdateRunner {
if (_tempFile.exists() && _tempFile.length() > 0) { if (_tempFile.exists() && _tempFile.length() > 0) {
File from; File from;
// TODO check magic number instead? // sud/su2 disabled
// But then a corrupt file would be displayed as-is... //if (url.endsWith(".su3") || url.contains(".su3?")) {
if (url.endsWith(".su3") || url.contains(".su3?")) {
try { try {
from = processSU3(); from = processSU3();
} catch (IOException ioe) { } catch (IOException ioe) {
@ -424,9 +435,9 @@ class NewsFetcher extends UpdateRunner {
_tempFile.delete(); _tempFile.delete();
return; return;
} }
} else { //} else {
from = _tempFile; // from = _tempFile;
} //}
boolean copied = FileUtil.rename(from, _newsFile); boolean copied = FileUtil.rename(from, _newsFile);
_tempFile.delete(); _tempFile.delete();
if (copied) { if (copied) {

View File

@ -84,7 +84,8 @@ public class UpdateHandler {
} else if (ConfigUpdateHandler.USE_SU3_UPDATE) { } else if (ConfigUpdateHandler.USE_SU3_UPDATE) {
update(ROUTER_SIGNED_SU3); update(ROUTER_SIGNED_SU3);
} else { } else {
update(ROUTER_SIGNED); // disabled, shouldn't get here
//update(ROUTER_SIGNED);
} }
} }
} }