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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2020-05-05 10:45:16 +09:30
parent 80f1f0ca15
commit 20abcd3ba3

View file

@ -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);
}