From e5a1cbaaf241f31842d0582379db600dd4446b49 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Wed, 13 Apr 2022 16:27:11 +0100 Subject: [PATCH] start embedded router when starting the core services --- core/src/main/groovy/com/muwire/core/Core.groovy | 9 +++++++-- gui/griffon-app/lifecycle/Ready.groovy | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/Core.groovy b/core/src/main/groovy/com/muwire/core/Core.groovy index 033a64c3..4a6fd2d5 100644 --- a/core/src/main/groovy/com/muwire/core/Core.groovy +++ b/core/src/main/groovy/com/muwire/core/Core.groovy @@ -213,8 +213,8 @@ public class Core { log.info "Initializing I2P context" I2PAppContext.getGlobalContext().logManager() I2PAppContext.getGlobalContext()._logManager = new MuWireLogManager() - router = null } + router = null } else { log.info("launching embedded router") Properties routerProps = new Properties() @@ -236,7 +236,6 @@ 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.runRouter() } log.info("initializing I2P socket manager") @@ -561,6 +560,12 @@ public class Core { hasherService.start() trustService.start() trustService.waitForLoad() + + if (router != null) { + router.runRouter() + Thread.sleep(1000) + } + i2pConnector.connect() contentManager.start() hostCache.start({connectionManager.getConnections().collect{ it.endpoint.destination }} as Supplier) diff --git a/gui/griffon-app/lifecycle/Ready.groovy b/gui/griffon-app/lifecycle/Ready.groovy index ef88556f..ce0d155c 100644 --- a/gui/griffon-app/lifecycle/Ready.groovy +++ b/gui/griffon-app/lifecycle/Ready.groovy @@ -116,7 +116,6 @@ class Ready extends AbstractLifecycleHandler { core.eventBus.publish(new UILoadedEvent()) def initer = { - Thread.sleep(1000) core.startServices() } as Runnable initer = new Thread(initer, "core initializer")