Skip to content

Commit

Permalink
Merge branch 'fix-updater-subscribe-changed-key' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneBab committed Nov 11, 2024
2 parents 2553579 + 7f9f0b0 commit b892b9b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/freenet/node/updater/NodeUpdater.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit b892b9b

Please sign in to comment.