wait for router.isRunning when starting services. Exit if it fails to start

dbus-notify
Zlatin Balevsky 2022-04-14 08:41:44 +01:00
parent f4ea9ad51b
commit feab16e461
No known key found for this signature in database
GPG Key ID: A72832072D525E41
1 changed files with 8 additions and 1 deletions

View File

@ -236,6 +236,7 @@ public class Core {
routerProps.setProperty("i2np.upnp.ipv6.enable", i2pOptions.getProperty("i2np.upnp.ipv6.enable","true"))
router = new Router(routerProps)
router.getContext().setLogManager(new MuWireLogManager())
router.setKillVMOnEnd(false)
}
log.info("initializing I2P socket manager")
@ -563,7 +564,13 @@ public class Core {
if (router != null) {
router.runRouter()
Thread.sleep(1000)
while(!router.isRunning()) {
Thread.sleep(100)
if (!router.isAlive()) {
log.severe("Router died while starting")
System.exit(0) // TODO: fire an event and let GUI know
}
}
}
i2pConnector.connect()