lightningd/plugin: Add a 'configured' member to the plugin struct, split 'plugins_init'

This adds a 'configured' boolean member to the plugin struct so that we can add plugins to ld->plugins' list and differenciate fresh plugins.
This also adds 'plugins_start' so that new plugins can be started without calling 'plugins_init' and running an io loop
This commit is contained in:
darosior
2019-07-02 00:00:32 +02:00
committed by Rusty Russell
parent 2e25c87bd4
commit ce12a37a2b
3 changed files with 41 additions and 12 deletions

View File

@@ -20,6 +20,7 @@ struct plugin {
bool stop;
struct plugins *plugins;
const char **plugin_path;
bool configured;
/* Stuff we read */
char *buffer;
@@ -53,6 +54,7 @@ struct plugin {
struct plugins {
struct list_head plugins;
size_t pending_manifests;
bool startup;
/* Currently pending requests by their request ID */
UINTMAP(struct jsonrpc_request *) pending_requests;
@@ -96,6 +98,8 @@ struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
*/
void plugins_add_default_dir(struct plugins *plugins, const char *default_dir);
void plugins_start(struct plugins *plugins, const char *dev_plugin_debug);
/**
* Initialize the registered plugins.
*