diff --git a/src/freenet/node/updater/NodeUpdater.java b/src/freenet/node/updater/NodeUpdater.java index 20e43dde20..46a25d97af 100644 --- a/src/freenet/node/updater/NodeUpdater.java +++ b/src/freenet/node/updater/NodeUpdater.java @@ -91,13 +91,17 @@ public abstract class NodeUpdater implements ClientGetCallback, USKCallback, Req } void start() { + subscribe(() -> manager.blow("The auto-update URI isn't valid and can't be used", true)); + } + + private void subscribe(Runnable onError) { try { // because of UoM, this version is actually worth having as well USK myUsk = USK.create(URI.setSuggestedEdition(currentVersion)); core.getUskManager().subscribe(myUsk, this, true, getRequestClient()); - } catch(MalformedURLException e) { + } catch (MalformedURLException e) { Logger.error(this, "The auto-update URI isn't valid and can't be used"); - manager.blow("The auto-update URI isn't valid and can't be used", true); + onError.run(); } } @@ -511,8 +515,9 @@ public synchronized boolean canUpdateNow() { /** Called when the fetch URI has changed. No major locks are held by caller. * @param uri The new URI. */ public void onChangeURI(FreenetURI uri) { - kill(); + kill(); // unsubscribes from the old uri this.URI = uri; + subscribe(() -> {}); maybeUpdate(); }