X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Ftodesbaum%2Fjsite%2Fapplication%2FUpdateChecker.java;h=11be944a1b66bff55b487eff20bbb6a26b62f011;hb=9345fa0d76206882d59a84515199da9d96cc1a3e;hp=bd3b14f5937713ecc67fc58d454edebeb8df3441;hpb=9e6e70c28963fde2a6c8b120974f8a70d4da25bc;p=jSite.git diff --git a/src/main/java/de/todesbaum/jsite/application/UpdateChecker.java b/src/main/java/de/todesbaum/jsite/application/UpdateChecker.java index bd3b14f..11be944 100644 --- a/src/main/java/de/todesbaum/jsite/application/UpdateChecker.java +++ b/src/main/java/de/todesbaum/jsite/application/UpdateChecker.java @@ -51,7 +51,7 @@ public class UpdateChecker implements Runnable { private static int counter = 0; /** The edition for the update check URL. */ - private static final int UPDATE_EDITION = 17; + private static final int UPDATE_EDITION = 18; /** The URL for update checks. */ private static final String UPDATE_KEY = "USK@e3myoFyp5avg6WYN16ImHri6J7Nj8980Fm~aQe4EX1U,QvbWT0ImE0TwLODTl7EoJx2NBnwDxTbLTE6zkB-eGPs,AQACAAE"; @@ -193,17 +193,31 @@ public class UpdateChecker implements Runnable { */ @Override public void run() { - Connection connection = freenetInterface.getConnection("jSite-" + ++counter + "-UpdateChecker"); - try { - connection.connect(); - } catch (IOException e1) { - e1.printStackTrace(); - } - Client client = new Client(connection); - boolean checkNow = false; int currentEdition = lastUpdateEdition; while (!shouldStop()) { - checkNow = false; + + /* try to connect. */ + Client client; + while (true) { + Connection connection = freenetInterface.getConnection("jSite-" + ++counter + "-UpdateChecker"); + try { + connection.connect(); + logger.log(Level.INFO, "Connected to " + freenetInterface.getNode() + "."); + client = new Client(connection); + break; + } catch (IOException ioe1) { + logger.log(Level.INFO, "Could not connect to " + freenetInterface.getNode() + ".", ioe1); + } + if (!connection.isConnected()) { + try { + Thread.sleep(60 * 1000); + } catch (InterruptedException ie1) { + /* ignore, we’re looping. */ + } + } + } + + boolean checkNow = false; logger.log(Level.FINE, "Trying " + constructUpdateKey(currentEdition)); ClientGet clientGet = new ClientGet("get-update-key"); clientGet.setUri(constructUpdateKey(currentEdition));