diff --git a/lightningd/plugin.c b/lightningd/plugin.c index 9628f9bc7cd4..03495714137d 100644 --- a/lightningd/plugin.c +++ b/lightningd/plugin.c @@ -77,7 +77,6 @@ struct plugins { struct log *log; struct log_book *log_book; - struct timers timers; struct lightningd *ld; }; @@ -107,7 +106,6 @@ struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book, list_head_init(&p->plugins); p->log_book = log_book; p->log = new_log(p, log_book, "plugin-manager"); - timers_init(&p->timers, time_mono()); p->ld = ld; return p; } @@ -965,8 +963,11 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug) int stdin, stdout; struct timer *expired; struct jsonrpc_request *req; + struct timers timers; + plugins->pending_manifests = 0; uintmap_init(&plugins->pending_requests); + timers_init(&timers, time_mono()); plugins_add_default_dir(plugins, path_join(tmpctx, plugins->ld->config_dir, "plugins")); @@ -1003,19 +1004,20 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug) p->timeout_timer = NULL; else { p->timeout_timer - = new_reltimer(&plugins->timers, p, + = new_reltimer(&timers, p, time_from_sec(PLUGIN_MANIFEST_TIMEOUT), plugin_manifest_timeout, p); } tal_free(cmd); } while (plugins->pending_manifests > 0) { - void *v = io_loop(&plugins->timers, &expired); + void *v = io_loop(&timers, &expired); if (v == plugins) break; if (expired) timer_expired(plugins, expired); } + timers_cleanup(&timers); } static void plugin_config_cb(const char *buffer,