From: David ‘Bombe’ Roden Date: Wed, 25 May 2011 17:47:34 +0000 (+0200) Subject: Request URI once before rescueing to (maybe) find the latest edition. X-Git-Tag: 0.6.5^2~23 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=57b65838f44ffc65a97aefbbec3e69b576cea7cd Request URI once before rescueing to (maybe) find the latest edition. --- diff --git a/src/main/java/net/pterodactylus/sone/core/Core.java b/src/main/java/net/pterodactylus/sone/core/Core.java index 32a47f6..c480d9b 100644 --- a/src/main/java/net/pterodactylus/sone/core/Core.java +++ b/src/main/java/net/pterodactylus/sone/core/Core.java @@ -867,6 +867,14 @@ public class Core implements IdentityListener, UpdateListener { coreListenerManager.fireRescuingSone(sone); lockSone(sone); long edition = sone.getLatestEdition(); + /* find the latest edition the node knows about. */ + Pair currentUri = freenetInterface.fetchUri(sone.getRequestUri()); + if (currentUri != null) { + long currentEdition = currentUri.getLeft().getEdition(); + if (currentEdition > edition) { + edition = currentEdition; + } + } while (!stopped && (edition >= 0) && preferences.isSoneRescueMode()) { logger.log(Level.FINE, "Downloading edition " + edition + "…"); soneDownloader.fetchSone(sone, sone.getRequestUri().setKeyType("SSK").setDocName("Sone-" + edition));