Skip to content

Commit 96c3b0e

Browse files
committed
lightningd/plugin: use ld's timer loop.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 8b7d14c commit 96c3b0e

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

lightningd/plugin.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <common/timeout.h>
1717
#include <dirent.h>
1818
#include <errno.h>
19+
#include <lightningd/io_loop_with_timers.h>
1920
#include <lightningd/json.h>
2021
#include <lightningd/lightningd.h>
2122
#include <lightningd/notification.h>
@@ -77,7 +78,6 @@ struct plugins {
7778
struct log *log;
7879
struct log_book *log_book;
7980

80-
struct timers timers;
8181
struct lightningd *ld;
8282
};
8383

@@ -107,7 +107,6 @@ struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book,
107107
list_head_init(&p->plugins);
108108
p->log_book = log_book;
109109
p->log = new_log(p, log_book, "plugin-manager");
110-
timers_init(&p->timers, time_mono());
111110
p->ld = ld;
112111
return p;
113112
}
@@ -969,7 +968,6 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug)
969968
struct plugin *p;
970969
char **cmd;
971970
int stdin, stdout;
972-
struct timer *expired;
973971
struct jsonrpc_request *req;
974972
plugins->pending_manifests = 0;
975973
uintmap_init(&plugins->pending_requests);
@@ -1009,19 +1007,15 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug)
10091007
p->timeout_timer = NULL;
10101008
else {
10111009
p->timeout_timer
1012-
= new_reltimer(&plugins->timers, p,
1010+
= new_reltimer(plugins->ld->timers, p,
10131011
time_from_sec(PLUGIN_MANIFEST_TIMEOUT),
10141012
plugin_manifest_timeout, p);
10151013
}
10161014
tal_free(cmd);
10171015
}
1018-
while (plugins->pending_manifests > 0) {
1019-
void *v = io_loop(&plugins->timers, &expired);
1020-
if (v == plugins)
1021-
break;
1022-
if (expired)
1023-
timer_expired(plugins, expired);
1024-
}
1016+
1017+
if (plugins->pending_manifests > 0)
1018+
io_loop_with_timers(plugins->ld);
10251019
}
10261020

10271021
static void plugin_config_cb(const char *buffer,

0 commit comments

Comments
 (0)