From 275d2834f2222ffa370cbdf0d38813dda62a3d72 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 5 Nov 2010 15:02:25 +0100 Subject: [PATCH] =?utf8?q?Don=E2=80=99t=20modify=20a=20Sone=20when=20the?= =?utf8?q?=20sone=20inserter=20was=20stopped=20before=20the=20insert=20fin?= =?utf8?q?ished.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/main/java/net/pterodactylus/sone/core/SoneInserter.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java index 35910eb..5b281f6 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneInserter.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneInserter.java @@ -143,6 +143,11 @@ public class SoneInserter extends AbstractService { try { core.setSoneStatus(sone, SoneStatus.inserting); FreenetURI finalUri = freenetInterface.insertDirectory(insertInformation.getInsertUri().setKeyType("USK").setSuggestedEdition(0), insertInformation.generateManifestEntries(), "index.html"); + /* at this point we might already be stopped. */ + if (shouldStop()) { + /* if so, bail out, don’t change anything. */ + break; + } sone.setLatestEdition(finalUri.getEdition()); success = true; logger.log(Level.INFO, "Inserted Sone “%s” at %s.", new Object[] { sone.getName(), finalUri }); -- 2.7.4