From 20abcd3ba3cd1f4184119220f65d3ed315bbfc1a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 5 May 2020 10:45:16 +0930 Subject: [PATCH] lightningd: final cleanup for plugins. 1. Make the destructor call check_plugins_resolved(), unless it was uninitialized (`opt_disable_plugin`). 2. Remove redundant list_del (destructor already does it). Signed-off-by: Rusty Russell --- lightningd/plugin.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 83a01618a..3460c89a6 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -113,6 +113,10 @@ static void destroy_plugin(struct plugin *p) call->cmd, PLUGIN_TERMINATED, "Plugin terminated before replying to RPC call.")); } + + /* Don't call this if we're still parsing options! */ + if (p->plugin_state != UNCONFIGURED) + check_plugins_resolved(p->plugins); } struct plugin *plugin_register(struct plugins *plugins, const char* path TAKES, @@ -190,14 +194,11 @@ void plugin_kill(struct plugin *plugin, const char *msg) { log_info(plugin->log, "Killing plugin: %s", msg); kill(plugin->pid, SIGKILL); - list_del(&plugin->list); - if (plugin->start_cmd) { plugin_cmd_killed(plugin->start_cmd, plugin, msg); plugin->start_cmd = NULL; } - check_plugins_resolved(plugin->plugins); tal_free(plugin); }