From 77833e7f765e7fb5374dbc21ed08b73281901825 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Tue, 12 Apr 2022 08:08:41 +0100 Subject: [PATCH] fix shutdown while I2P router is initializing --- .../groovy/com/muwire/core/connection/I2PConnector.groovy | 6 ++---- .../groovy/com/muwire/core/hostcache/H2HostCache.groovy | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy b/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy index afb874d6..2532bbe0 100644 --- a/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy @@ -62,10 +62,8 @@ class I2PConnector { } } - synchronized void shutdown() { - if (socketManager == null) - return - socketManager.destroySocketManager() + void shutdown() { + socketManager?.destroySocketManager() socketManager = null } diff --git a/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy b/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy index 2915beb2..4a3166f6 100644 --- a/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy +++ b/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy @@ -300,8 +300,8 @@ class H2HostCache extends HostCache { } @Override public synchronized void stop() { - timer.cancel() - sql.close() + try {timer.cancel()} catch (Exception ignore) {} + sql?.close() } @Override public synchronized void load() {