Merge branch '1777-lifecycle-manager' into 'master'

Allow process to exit if an exception is thrown during shutdown

Closes #1777

See merge request briar/briar!1668
This commit is contained in:
akwizgran
2022-06-29 14:23:16 +00:00
4 changed files with 112 additions and 51 deletions

View File

@@ -156,8 +156,11 @@ public class BriarService extends Service {
if (result == SUCCESS) {
started = true;
} else if (result == ALREADY_RUNNING) {
LOG.info("Already running");
stopSelf();
LOG.warning("Already running");
// The core has outlived the original BriarService
// instance. We don't know how to recover from this
// unexpected state, so try to exit cleanly
shutdownFromBackground();
} else {
if (LOG.isLoggable(WARNING))
LOG.warning("Startup failed: " + result);