mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-21 16:14:23 +01:00
lightningd/plugin: use ld's timer loop.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
#include <common/timeout.h>
|
#include <common/timeout.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <lightningd/io_loop_with_timers.h>
|
||||||
#include <lightningd/json.h>
|
#include <lightningd/json.h>
|
||||||
#include <lightningd/lightningd.h>
|
#include <lightningd/lightningd.h>
|
||||||
#include <lightningd/notification.h>
|
#include <lightningd/notification.h>
|
||||||
@@ -77,7 +78,6 @@ struct plugins {
|
|||||||
struct log *log;
|
struct log *log;
|
||||||
struct log_book *log_book;
|
struct log_book *log_book;
|
||||||
|
|
||||||
struct timers timers;
|
|
||||||
struct lightningd *ld;
|
struct lightningd *ld;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -107,7 +107,6 @@ struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
|
|||||||
list_head_init(&p->plugins);
|
list_head_init(&p->plugins);
|
||||||
p->log_book = log_book;
|
p->log_book = log_book;
|
||||||
p->log = new_log(p, log_book, "plugin-manager");
|
p->log = new_log(p, log_book, "plugin-manager");
|
||||||
timers_init(&p->timers, time_mono());
|
|
||||||
p->ld = ld;
|
p->ld = ld;
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
@@ -969,7 +968,6 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug)
|
|||||||
struct plugin *p;
|
struct plugin *p;
|
||||||
char **cmd;
|
char **cmd;
|
||||||
int stdin, stdout;
|
int stdin, stdout;
|
||||||
struct timer *expired;
|
|
||||||
struct jsonrpc_request *req;
|
struct jsonrpc_request *req;
|
||||||
plugins->pending_manifests = 0;
|
plugins->pending_manifests = 0;
|
||||||
uintmap_init(&plugins->pending_requests);
|
uintmap_init(&plugins->pending_requests);
|
||||||
@@ -1009,19 +1007,15 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug)
|
|||||||
p->timeout_timer = NULL;
|
p->timeout_timer = NULL;
|
||||||
else {
|
else {
|
||||||
p->timeout_timer
|
p->timeout_timer
|
||||||
= new_reltimer(&plugins->timers, p,
|
= new_reltimer(plugins->ld->timers, p,
|
||||||
time_from_sec(PLUGIN_MANIFEST_TIMEOUT),
|
time_from_sec(PLUGIN_MANIFEST_TIMEOUT),
|
||||||
plugin_manifest_timeout, p);
|
plugin_manifest_timeout, p);
|
||||||
}
|
}
|
||||||
tal_free(cmd);
|
tal_free(cmd);
|
||||||
}
|
}
|
||||||
while (plugins->pending_manifests > 0) {
|
|
||||||
void *v = io_loop(&plugins->timers, &expired);
|
if (plugins->pending_manifests > 0)
|
||||||
if (v == plugins)
|
io_loop_with_timers(plugins->ld);
|
||||||
break;
|
|
||||||
if (expired)
|
|
||||||
timer_expired(plugins, expired);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void plugin_config_cb(const char *buffer,
|
static void plugin_config_cb(const char *buffer,
|
||||||
|
|||||||
Reference in New Issue
Block a user