I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 9b8d3eb6 authored by zzz's avatar zzz
Browse files

Startup:

    Wait a while and recheck if a recent ping file is there,
    so that a crashed router doesn't prevent a restart (ticket #633)
parent dbe0a824
No related branches found
No related tags found
No related merge requests found
...@@ -234,13 +234,28 @@ public class Router implements RouterClock.ClockShiftListener { ...@@ -234,13 +234,28 @@ public class Router implements RouterClock.ClockShiftListener {
// for the ping file // for the ping file
// Check for other router but do not start a thread yet so the update doesn't cause // Check for other router but do not start a thread yet so the update doesn't cause
// a NCDFE // a NCDFE
if (!isOnlyRouterRunning()) { for (int i = 0; i < 14; i++) {
_eventLog.addEvent(EventLog.ABORTED, "Another router running"); // Wrapper can start us up too quickly after a crash, the ping file
System.err.println("ERROR: There appears to be another router already running!"); // may still be less than LIVELINESS_DELAY (60s) old.
System.err.println(" Please make sure to shut down old instances before starting up"); // So wait at least 60s to be sure.
System.err.println(" a new one. If you are positive that no other instance is running,"); if (isOnlyRouterRunning()) {
System.err.println(" please delete the file " + getPingFile().getAbsolutePath()); if (i > 0)
System.exit(-1); System.err.println("INFO: No, there wasn't another router already running. Proceeding with startup.");
break;
}
if (i < 13) {
if (i == 0)
System.err.println("WARN: There may be another router already running. Waiting a while to be sure...");
// yes this is ugly to sleep in the constructor.
try { Thread.sleep(5000); } catch (InterruptedException ie) {}
} else {
_eventLog.addEvent(EventLog.ABORTED, "Another router running");
System.err.println("ERROR: There appears to be another router already running!");
System.err.println(" Please make sure to shut down old instances before starting up");
System.err.println(" a new one. If you are positive that no other instance is running,");
System.err.println(" please delete the file " + getPingFile().getAbsolutePath());
System.exit(-1);
}
} }
if (_config.get("router.firstVersion") == null) { if (_config.get("router.firstVersion") == null) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment