forked from I2P_Developers/i2p.i2p
Update: Add support for su3-signed development builds (ticket #1381)
Full version is used as the su3 version. Uses same su3 certs as release updates. Users may add additional certs to ~/.i2p/certificates/router/ as necessary. Copy echelon's reseed key for use as a router signer. Unsigned update remains a separate option for now. Various update subsystem cleanups.
This commit is contained in:
@ -82,6 +82,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
private static final long STATUS_CLEAN_TIME = 20*60*1000;
|
||||
private static final long TASK_CLEANER_TIME = 15*60*1000;
|
||||
private static final String PROP_UNSIGNED_AVAILABLE = "router.updateUnsignedAvailable";
|
||||
private static final String PROP_DEV_SU3_AVAILABLE = "router.updateDevSU3Available";
|
||||
|
||||
/**
|
||||
* @param args ignored
|
||||
@ -174,6 +175,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
// TODO see NewsFetcher
|
||||
//register(u, ROUTER_SIGNED, HTTPS_CLEARNET, -5);
|
||||
//register(u, ROUTER_SIGNED, HTTP_CLEARNET, -10);
|
||||
|
||||
UnsignedUpdateHandler uuh = new UnsignedUpdateHandler(_context, this);
|
||||
register((Checker)uuh, ROUTER_UNSIGNED, HTTP, 0);
|
||||
register((Updater)uuh, ROUTER_UNSIGNED, HTTP, 0);
|
||||
@ -185,6 +187,19 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
_available.put(new UpdateItem(ROUTER_UNSIGNED, ""), newVA);
|
||||
}
|
||||
}
|
||||
|
||||
DevSU3UpdateHandler dsuh = new DevSU3UpdateHandler(_context, this);
|
||||
register((Checker)dsuh, ROUTER_DEV_SU3, HTTP, 0);
|
||||
register((Updater)dsuh, ROUTER_DEV_SU3, HTTP, 0);
|
||||
newVersion = _context.getProperty(PROP_DEV_SU3_AVAILABLE);
|
||||
if (newVersion != null) {
|
||||
List<URI> updateSources = dsuh.getUpdateSources();
|
||||
if (dsuh != null) {
|
||||
VersionAvailable newVA = new VersionAvailable(newVersion, "", HTTP, updateSources);
|
||||
_available.put(new UpdateItem(ROUTER_DEV_SU3, ""), newVA);
|
||||
}
|
||||
}
|
||||
|
||||
PluginUpdateHandler puh = new PluginUpdateHandler(_context, this);
|
||||
register((Checker)puh, PLUGIN, HTTP, 0);
|
||||
register((Updater)puh, PLUGIN, HTTP, 0);
|
||||
@ -652,7 +667,8 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
* Call once for each type/method pair.
|
||||
*/
|
||||
public void register(Updater updater, UpdateType type, UpdateMethod method, int priority) {
|
||||
if ((type == ROUTER_SIGNED || type == ROUTER_UNSIGNED || type == ROUTER_SIGNED_SU3) &&
|
||||
if ((type == ROUTER_SIGNED || type == ROUTER_UNSIGNED ||
|
||||
type == ROUTER_SIGNED_SU3 || type == ROUTER_DEV_SU3) &&
|
||||
NewsHelper.dontInstall(_context)) {
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Ignoring registration for " + type + ", router updates disabled");
|
||||
@ -813,8 +829,11 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
break;
|
||||
|
||||
case ROUTER_UNSIGNED:
|
||||
case ROUTER_DEV_SU3:
|
||||
// save across restarts
|
||||
_context.router().saveConfig(PROP_UNSIGNED_AVAILABLE, newVersion);
|
||||
String prop = type == ROUTER_UNSIGNED ? PROP_UNSIGNED_AVAILABLE
|
||||
: PROP_DEV_SU3_AVAILABLE;
|
||||
_context.router().saveConfig(prop, newVersion);
|
||||
// fall through
|
||||
|
||||
case ROUTER_SIGNED:
|
||||
@ -822,6 +841,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
if (shouldInstall() &&
|
||||
!(isUpdateInProgress(ROUTER_SIGNED) ||
|
||||
isUpdateInProgress(ROUTER_SIGNED_SU3) ||
|
||||
isUpdateInProgress(ROUTER_DEV_SU3) ||
|
||||
isUpdateInProgress(ROUTER_UNSIGNED))) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Updating " + ui + " after notify");
|
||||
@ -908,6 +928,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
case ROUTER_SIGNED:
|
||||
case ROUTER_SIGNED_SU3:
|
||||
case ROUTER_UNSIGNED:
|
||||
case ROUTER_DEV_SU3:
|
||||
// ConfigUpdateHandler, SummaryHelper, SummaryBarRenderer handle status display
|
||||
break;
|
||||
|
||||
@ -1061,6 +1082,14 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
}
|
||||
break;
|
||||
|
||||
case ROUTER_DEV_SU3:
|
||||
rv = handleSu3File(task.getURI(), actualVersion, file);
|
||||
if (rv) {
|
||||
_context.router().saveConfig(PROP_DEV_SU3_AVAILABLE, null);
|
||||
notifyDownloaded(task.getType(), task.getID(), actualVersion);
|
||||
}
|
||||
break;
|
||||
|
||||
case PLUGIN: // file handled in PluginUpdateRunner
|
||||
default: // assume Updater installed it
|
||||
rv = true;
|
||||
@ -1111,6 +1140,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
if (type == ROUTER_SIGNED) {
|
||||
_downloaded.remove(new UpdateItem(ROUTER_UNSIGNED, ""));
|
||||
_downloaded.remove(new UpdateItem(ROUTER_SIGNED_SU3, ""));
|
||||
_downloaded.remove(new UpdateItem(ROUTER_DEV_SU3, ""));
|
||||
// remove available from other type
|
||||
UpdateItem altui = new UpdateItem(ROUTER_SIGNED_SU3, id);
|
||||
Version old = _available.get(altui);
|
||||
@ -1121,6 +1151,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
} else if (type == ROUTER_SIGNED_SU3) {
|
||||
_downloaded.remove(new UpdateItem(ROUTER_SIGNED, ""));
|
||||
_downloaded.remove(new UpdateItem(ROUTER_UNSIGNED, ""));
|
||||
_downloaded.remove(new UpdateItem(ROUTER_DEV_SU3, ""));
|
||||
// remove available from other type
|
||||
UpdateItem altui = new UpdateItem(ROUTER_SIGNED, id);
|
||||
Version old = _available.get(altui);
|
||||
@ -1131,6 +1162,11 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
} else if (type == ROUTER_UNSIGNED) {
|
||||
_downloaded.remove(new UpdateItem(ROUTER_SIGNED, ""));
|
||||
_downloaded.remove(new UpdateItem(ROUTER_SIGNED_SU3, ""));
|
||||
_downloaded.remove(new UpdateItem(ROUTER_DEV_SU3, ""));
|
||||
} else if (type == ROUTER_DEV_SU3) {
|
||||
_downloaded.remove(new UpdateItem(ROUTER_SIGNED, ""));
|
||||
_downloaded.remove(new UpdateItem(ROUTER_SIGNED_SU3, ""));
|
||||
_downloaded.remove(new UpdateItem(ROUTER_UNSIGNED, ""));
|
||||
}
|
||||
Version old = _available.get(ui);
|
||||
if (old != null && old.compareTo(ver) <= 0)
|
||||
@ -1202,6 +1238,15 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
}
|
||||
break;
|
||||
|
||||
case ROUTER_DEV_SU3:
|
||||
String url3 = _context.getProperty(ConfigUpdateHandler.PROP_DEV_SU3_URL);
|
||||
if (url3 != null) {
|
||||
try {
|
||||
return Collections.singletonList(new URI(url3));
|
||||
} catch (URISyntaxException use) {}
|
||||
}
|
||||
break;
|
||||
|
||||
case PLUGIN:
|
||||
Properties props = PluginStarter.pluginProperties(_context, id);
|
||||
String xpi2pURL = props.getProperty("updateURL");
|
||||
|
@ -0,0 +1,93 @@
|
||||
package net.i2p.router.update;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.update.*;
|
||||
import net.i2p.util.PartialEepGet;
|
||||
import net.i2p.util.PortMapper;
|
||||
import net.i2p.util.VersionComparator;
|
||||
|
||||
/**
|
||||
* Check for an updated su3 version.
|
||||
*
|
||||
* Take the update URL
|
||||
* then fetch the first 56 bytes of the URL, extract the version,
|
||||
* and compare to current full router version.
|
||||
*
|
||||
* @since 0.9.20 from PluginUpdateChecker
|
||||
*/
|
||||
class DevSU3UpdateChecker extends UpdateRunner {
|
||||
|
||||
public DevSU3UpdateChecker(RouterContext ctx, ConsoleUpdateManager mgr,
|
||||
List<URI> uris) {
|
||||
super(ctx, mgr, UpdateType.ROUTER_DEV_SU3, uris, RouterVersion.FULL_VERSION);
|
||||
if (!uris.isEmpty())
|
||||
_currentURI = uris.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update() {
|
||||
// must be set for super
|
||||
_isPartial = true;
|
||||
// use the same settings as for updater
|
||||
// always proxy, or else FIXME
|
||||
//boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
|
||||
String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
|
||||
int proxyPort = ConfigUpdateHandler.proxyPort(_context);
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
_mgr.notifyCheckComplete(this, false, false);
|
||||
return;
|
||||
}
|
||||
//updateStatus("<b>" + _("Checking for development build update") + "</b>");
|
||||
_baos.reset();
|
||||
try {
|
||||
_get = new PartialEepGet(_context, proxyHost, proxyPort, _baos, _currentURI.toString(), TrustedUpdate.HEADER_BYTES);
|
||||
_get.addStatusListener(this);
|
||||
_get.fetch(CONNECT_TIMEOUT);
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error fetching the update", t);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred,
|
||||
long bytesRemaining, String url) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining,
|
||||
String url, String outputFile, boolean notModified) {
|
||||
String newVersion = TrustedUpdate.getVersionString(new ByteArrayInputStream(_baos.toByteArray()));
|
||||
boolean newer = VersionComparator.comp(newVersion, RouterVersion.FULL_VERSION) > 0;
|
||||
if (newer) {
|
||||
_mgr.notifyVersionAvailable(this, _currentURI, UpdateType.ROUTER_DEV_SU3, "", UpdateMethod.HTTP,
|
||||
_urls, newVersion, RouterVersion.FULL_VERSION);
|
||||
} else {
|
||||
updateStatus("<b>" + _("No new version found at {0}", linkify(url)) + "</b>");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Found old version \"" + newVersion + "\" at " + url);
|
||||
}
|
||||
_mgr.notifyCheckComplete(this, newer, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
||||
File f = new File(_updateFile);
|
||||
f.delete();
|
||||
_mgr.notifyCheckComplete(this, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,94 @@
|
||||
package net.i2p.router.update;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.router.web.NewsHelper;
|
||||
import net.i2p.update.*;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import static net.i2p.update.UpdateMethod.*;
|
||||
|
||||
/**
|
||||
* <p>Handles the request to update the router by firing off an
|
||||
* {@link net.i2p.util.EepGet} call to download the latest su3 file
|
||||
* and display the status.
|
||||
* </p>
|
||||
* <p>After the download completes the su3 is verified, and the zip is extracted
|
||||
* and copied to the router directory,
|
||||
* and if configured the router is restarted to complete
|
||||
* the update process.
|
||||
* </p>
|
||||
*
|
||||
* @since 0.9.20
|
||||
*/
|
||||
class DevSU3UpdateHandler implements Checker, Updater {
|
||||
private final RouterContext _context;
|
||||
private final ConsoleUpdateManager _mgr;
|
||||
|
||||
public DevSU3UpdateHandler(RouterContext ctx, ConsoleUpdateManager mgr) {
|
||||
_context = ctx;
|
||||
_mgr = mgr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return null if none
|
||||
*/
|
||||
public List<URI> getUpdateSources() {
|
||||
String url = _context.getProperty(ConfigUpdateHandler.PROP_DEV_SU3_URL);
|
||||
if (url == null)
|
||||
return null;
|
||||
|
||||
try {
|
||||
return Collections.singletonList(new URI(url));
|
||||
} catch (URISyntaxException use) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param currentVersion ignored, we use current router version
|
||||
* @return active task or null if unable to check
|
||||
*/
|
||||
public UpdateTask check(UpdateType type, UpdateMethod method,
|
||||
String id, String currentVersion, long maxTime) {
|
||||
if (type != UpdateType.ROUTER_DEV_SU3 || method != UpdateMethod.HTTP)
|
||||
return null;
|
||||
|
||||
List<URI> updateSources = getUpdateSources();
|
||||
if (updateSources == null)
|
||||
return null;
|
||||
|
||||
long ms = _context.getProperty(NewsHelper.PROP_LAST_UPDATE_TIME, 0L);
|
||||
if (ms <= 0) {
|
||||
// we don't know what version you have, so stamp it with the current time,
|
||||
// and we'll look for something newer next time around.
|
||||
_context.router().saveConfig(NewsHelper.PROP_LAST_UPDATE_TIME,
|
||||
Long.toString(_context.clock().now()));
|
||||
}
|
||||
|
||||
UpdateRunner update = new DevSU3UpdateChecker(_context, _mgr, updateSources);
|
||||
return update;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start a download and return a handle to the download task.
|
||||
* Should not block.
|
||||
*
|
||||
* @param id plugin name or ignored
|
||||
* @param maxTime how long you have
|
||||
* @return active task or null if unable to download
|
||||
*/
|
||||
public UpdateTask update(UpdateType type, UpdateMethod method, List<URI> updateSources,
|
||||
String id, String newVersion, long maxTime) {
|
||||
if (type != ROUTER_DEV_SU3 || method != HTTP || updateSources.isEmpty())
|
||||
return null;
|
||||
UpdateRunner update = new DevSU3UpdateRunner(_context, _mgr, updateSources);
|
||||
// set status before thread to ensure UI feedback
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
|
||||
return update;
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package net.i2p.router.update;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import net.i2p.util.EepGet;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.PortMapper;
|
||||
|
||||
|
||||
/**
|
||||
* Eepget the .su3 file to the temp dir, then notify.
|
||||
* ConsoleUpdateManager will do the rest.
|
||||
*
|
||||
* @since 0.9.20
|
||||
*/
|
||||
class DevSU3UpdateRunner extends UpdateRunner {
|
||||
|
||||
public DevSU3UpdateRunner(RouterContext ctx, ConsoleUpdateManager mgr, List<URI> uris) {
|
||||
super(ctx, mgr, ROUTER_DEV_SU3, uris);
|
||||
if (!uris.isEmpty())
|
||||
_currentURI = uris.get(0);
|
||||
}
|
||||
|
||||
/** Get the file */
|
||||
@Override
|
||||
protected void update() {
|
||||
// always proxy for now
|
||||
//boolean shouldProxy = Boolean.valueOf(_context.getProperty(ConfigUpdateHandler.PROP_SHOULD_PROXY, ConfigUpdateHandler.DEFAULT_SHOULD_PROXY)).booleanValue();
|
||||
String proxyHost = _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
|
||||
int proxyPort = ConfigUpdateHandler.proxyPort(_context);
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
_mgr.notifyTaskFailed(this, msg, null);
|
||||
return;
|
||||
}
|
||||
String zipURL = _currentURI.toString();
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Starting signed dev update URL: " + zipURL);
|
||||
try {
|
||||
// 40 retries!!
|
||||
_get = new EepGet(_context, proxyHost, proxyPort, 40, _updateFile, zipURL, false);
|
||||
_get.addStatusListener(DevSU3UpdateRunner.this);
|
||||
_get.fetch(CONNECT_TIMEOUT, -1, INACTIVITY_TIMEOUT);
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error updating", t);
|
||||
}
|
||||
if (!this.done)
|
||||
_mgr.notifyTaskFailed(this, "", null);
|
||||
}
|
||||
|
||||
/** eepget listener callback Overrides */
|
||||
@Override
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining,
|
||||
String url, String outputFile, boolean notModified) {
|
||||
File tmp = new File(_updateFile);
|
||||
// We use TrustedUpdate here to get the version without any su3 checks,
|
||||
// which will be done later.
|
||||
// Only gets 16 bytes max since we aren't using the SU3 version extraction.
|
||||
String version = TrustedUpdate.getVersionString(tmp);
|
||||
if (version.equals(""))
|
||||
version = "unknown";
|
||||
if (_mgr.notifyComplete(this, version, tmp))
|
||||
this.done = true;
|
||||
else
|
||||
tmp.delete(); // corrupt
|
||||
}
|
||||
}
|
@ -73,6 +73,8 @@ class NewsFetcher extends UpdateRunner {
|
||||
_isRunning = true;
|
||||
try {
|
||||
fetchNews();
|
||||
} catch (Throwable t) {
|
||||
_mgr.notifyTaskFailed(this, "", t);
|
||||
} finally {
|
||||
_mgr.notifyCheckComplete(this, _isNewer, _success);
|
||||
_isRunning = false;
|
||||
|
@ -101,15 +101,13 @@ class NewsTimerTask implements SimpleTimer.TimedEvent {
|
||||
_context.getBooleanProperty(ConfigUpdateHandler.PROP_UPDATE_UNSIGNED) &&
|
||||
!NewsHelper.dontInstall(_context);
|
||||
}
|
||||
|
||||
/**
|
||||
* HEAD the update url, and if the last-mod time is newer than the last update we
|
||||
* downloaded, as stored in the properties, then we download it using eepget.
|
||||
*
|
||||
* Non-blocking
|
||||
*/
|
||||
private void fetchUnsignedHead() {
|
||||
_mgr.check(ROUTER_UNSIGNED);
|
||||
|
||||
/** @since 0.9.20 */
|
||||
private boolean shouldFetchDevSU3() {
|
||||
String url = _context.getProperty(ConfigUpdateHandler.PROP_DEV_SU3_URL);
|
||||
return url != null && url.length() > 0 &&
|
||||
_context.getBooleanProperty(ConfigUpdateHandler.PROP_UPDATE_DEV_SU3) &&
|
||||
!NewsHelper.dontInstall(_context);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,12 +124,19 @@ class NewsTimerTask implements SimpleTimer.TimedEvent {
|
||||
public void run() {
|
||||
// blocking
|
||||
fetchNews();
|
||||
if (shouldFetchDevSU3()) {
|
||||
// give it a sec for the download to kick in, if it's going to
|
||||
try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
|
||||
if (!_mgr.isCheckInProgress() && !_mgr.isUpdateInProgress())
|
||||
// nonblocking
|
||||
_mgr.check(ROUTER_DEV_SU3);
|
||||
}
|
||||
if (shouldFetchUnsigned()) {
|
||||
// give it a sec for the download to kick in, if it's going to
|
||||
try { Thread.sleep(5*1000); } catch (InterruptedException ie) {}
|
||||
if (!_mgr.isCheckInProgress() && !_mgr.isUpdateInProgress())
|
||||
// nonblocking
|
||||
fetchUnsignedHead();
|
||||
_mgr.check(ROUTER_UNSIGNED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,16 +40,6 @@ class PluginUpdateChecker extends UpdateRunner {
|
||||
@Override
|
||||
public String getID() { return _appName; }
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
_isRunning = true;
|
||||
try {
|
||||
update();
|
||||
} finally {
|
||||
_isRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update() {
|
||||
// must be set for super
|
||||
|
@ -22,8 +22,6 @@ class UnsignedUpdateChecker extends UpdateRunner {
|
||||
private final long _ms;
|
||||
private boolean _unsignedUpdateAvailable;
|
||||
|
||||
protected static final String SIGNED_UPDATE_FILE = "i2pupdate.sud";
|
||||
|
||||
public UnsignedUpdateChecker(RouterContext ctx, ConsoleUpdateManager mgr,
|
||||
List<URI> uris, long lastUpdateTime) {
|
||||
super(ctx, mgr, UpdateType.ROUTER_UNSIGNED, uris);
|
||||
@ -36,6 +34,8 @@ class UnsignedUpdateChecker extends UpdateRunner {
|
||||
boolean success = false;
|
||||
try {
|
||||
success = fetchUnsignedHead();
|
||||
} catch (Throwable t) {
|
||||
_mgr.notifyTaskFailed(this, "", t);
|
||||
} finally {
|
||||
_mgr.notifyCheckComplete(this, _unsignedUpdateAvailable, success);
|
||||
_isRunning = false;
|
||||
@ -59,11 +59,14 @@ class UnsignedUpdateChecker extends UpdateRunner {
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Cannot check for unsigned update - HTTP client tunnel not running");
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
return false;
|
||||
}
|
||||
|
||||
//updateStatus("<b>" + _("Checking for development build update") + "</b>");
|
||||
try {
|
||||
EepHead get = new EepHead(_context, proxyHost, proxyPort, 0, url);
|
||||
if (get.fetch()) {
|
||||
@ -81,7 +84,7 @@ class UnsignedUpdateChecker extends UpdateRunner {
|
||||
return true;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
_log.error("Error fetching the unsigned update", t);
|
||||
_log.error("Error fetching the update", t);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -47,8 +47,6 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
|
||||
protected URI _currentURI;
|
||||
private final String _currentVersion;
|
||||
|
||||
private static final String SIGNED_UPDATE_FILE = "i2pupdate.sud";
|
||||
|
||||
protected static final long CONNECT_TIMEOUT = 55*1000;
|
||||
protected static final long INACTIVITY_TIMEOUT = 5*60*1000;
|
||||
protected static final long NOPROXY_INACTIVITY_TIMEOUT = 60*1000;
|
||||
|
Reference in New Issue
Block a user