From 57b65838f44ffc65a97aefbbec3e69b576cea7cd Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 25 May 2011 19:47:34 +0200 Subject: [PATCH] Request URI once before rescueing to (maybe) find the latest edition. --- src/main/java/net/pterodactylus/sone/core/Core.java | 8 ++++++++ 1 file changed, 8 insertions(+) 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)); -- 2.7.4