From 0f6d0393915752b26e6fe871aa92066cf6fcdfda Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Sun, 23 Mar 2014 10:55:00 +0000 Subject: [PATCH] Console: Handle stopping plugin ClientApps --- .../src/net/i2p/router/web/PluginStarter.java | 16 ++++++++++++++++ history.txt | 3 +++ 2 files changed, 19 insertions(+) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java index cb09a1e5eb..ea372ec5c8 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java @@ -19,6 +19,8 @@ import java.util.concurrent.ConcurrentHashMap; import net.i2p.CoreVersion; import net.i2p.I2PAppContext; +import net.i2p.app.ClientApp; +import net.i2p.app.ClientAppState; import net.i2p.data.DataHelper; import net.i2p.router.RouterContext; import net.i2p.router.RouterVersion; @@ -602,6 +604,20 @@ public class PluginStarter implements Runnable { _pendingPluginClients.put(pluginName, new ConcurrentHashSet<SimpleTimer2.TimedEvent>()); for(ClientAppConfig app : apps) { + // If the client is a running ClientApp that we want to stop, + // bypass all the logic below. + ClientApp ca = ctx.routerAppManager().getClientApp(app.className, LoadClientAppsJob.parseArgs(app.args)); + if (ca != null && ca.getState() == ClientAppState.RUNNING) { + if (action.equals("stop")) { + try { + ca.shutdown(LoadClientAppsJob.parseArgs(app.stopargs)); + } catch (Throwable t) { + throw new Exception(t); + } + continue; + } + } + if (action.equals("start") && app.disabled) continue; String argVal[]; diff --git a/history.txt b/history.txt index afddf70d06..3f4932e98b 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2014-03-23 str4d + * Console: Handle stopping plugin ClientApps + 2014-03-16 zzz * SSU: Fix corruption of introducer keys -- GitLab