Router: Don't log updated/started/stopped/crashed events when in test mode

This commit is contained in:
zzz
2023-11-19 09:31:10 -05:00
parent 725181b0dc
commit bcdd01448f
2 changed files with 7 additions and 4 deletions

View File

@ -684,11 +684,12 @@ public class Router implements RouterClock.ClockShiftListener {
changeState(State.STARTING_1); changeState(State.STARTING_1);
} }
String last = _config.get("router.previousFullVersion"); String last = _config.get("router.previousFullVersion");
if (last != null) { if (last != null && !_context.getBooleanProperty("i2p.vmCommSystem")) {
_eventLog.addEvent(EventLog.UPDATED, "from " + last + " to " + RouterVersion.FULL_VERSION); _eventLog.addEvent(EventLog.UPDATED, "from " + last + " to " + RouterVersion.FULL_VERSION);
saveConfig("router.previousFullVersion", null); saveConfig("router.previousFullVersion", null);
} }
_eventLog.addEvent(EventLog.STARTED, RouterVersion.FULL_VERSION); if (!_context.getBooleanProperty("i2p.vmCommSystem"))
_eventLog.addEvent(EventLog.STARTED, RouterVersion.FULL_VERSION);
startupStuff(); startupStuff();
changeState(State.STARTING_2); changeState(State.STARTING_2);
_started = System.currentTimeMillis(); _started = System.currentTimeMillis();
@ -1640,7 +1641,8 @@ public class Router implements RouterClock.ClockShiftListener {
// logManager shut down in finalShutdown() // logManager shut down in finalShutdown()
_watchdog.shutdown(); _watchdog.shutdown();
_watchdogThread.interrupt(); _watchdogThread.interrupt();
_eventLog.addEvent(EventLog.STOPPED, Integer.toString(exitCode)); if (!_context.commSystem().isDummy())
_eventLog.addEvent(EventLog.STOPPED, Integer.toString(exitCode));
finalShutdown(exitCode); finalShutdown(exitCode);
} }

View File

@ -39,7 +39,8 @@ public class ShutdownHook extends Thread {
// Needed to make the wrapper happy, otherwise it gets confused // Needed to make the wrapper happy, otherwise it gets confused
// and thinks we haven't shut down, possibly because it // and thinks we haven't shut down, possibly because it
// prevents other shutdown hooks from running // prevents other shutdown hooks from running
_context.router().eventLog().addEvent(EventLog.CRASHED, RouterVersion.FULL_VERSION); if (!_context.commSystem().isDummy())
_context.router().eventLog().addEvent(EventLog.CRASHED, RouterVersion.FULL_VERSION);
_context.router().setKillVMOnEnd(false); _context.router().setKillVMOnEnd(false);
_context.router().shutdown2(Router.EXIT_HARD); _context.router().shutdown2(Router.EXIT_HARD);
} }