Shutdown controller, and hence entire node, if networking or API fail to start.

This commit is contained in:
catbref 2020-03-11 15:46:59 +00:00
parent 90e0f9dddc
commit 64055e280d

View File

@ -311,6 +311,7 @@ public class Controller extends Thread {
network.start(); network.start();
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("Unable to start networking", e); LOGGER.error("Unable to start networking", e);
Controller.getInstance().shutdown();
Gui.getInstance().fatalError("Networking failure", e); Gui.getInstance().fatalError("Networking failure", e);
return; // Not System.exit() so that GUI can display error return; // Not System.exit() so that GUI can display error
} }
@ -344,6 +345,7 @@ public class Controller extends Thread {
apiService.start(); apiService.start();
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("Unable to start API", e); LOGGER.error("Unable to start API", e);
Controller.getInstance().shutdown();
Gui.getInstance().fatalError("API failure", e); Gui.getInstance().fatalError("API failure", e);
return; // Not System.exit() so that GUI can display error return; // Not System.exit() so that GUI can display error
} }