|
16 | 16 | #include <common/timeout.h> |
17 | 17 | #include <dirent.h> |
18 | 18 | #include <errno.h> |
| 19 | +#include <lightningd/io_loop_with_timers.h> |
19 | 20 | #include <lightningd/json.h> |
20 | 21 | #include <lightningd/lightningd.h> |
21 | 22 | #include <lightningd/notification.h> |
@@ -77,7 +78,6 @@ struct plugins { |
77 | 78 | struct log *log; |
78 | 79 | struct log_book *log_book; |
79 | 80 |
|
80 | | - struct timers timers; |
81 | 81 | struct lightningd *ld; |
82 | 82 | }; |
83 | 83 |
|
@@ -107,7 +107,6 @@ struct plugins *plugins_new(const tal_t *ctx, struct log_book *log_book, |
107 | 107 | list_head_init(&p->plugins); |
108 | 108 | p->log_book = log_book; |
109 | 109 | p->log = new_log(p, log_book, "plugin-manager"); |
110 | | - timers_init(&p->timers, time_mono()); |
111 | 110 | p->ld = ld; |
112 | 111 | return p; |
113 | 112 | } |
@@ -969,7 +968,6 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug) |
969 | 968 | struct plugin *p; |
970 | 969 | char **cmd; |
971 | 970 | int stdin, stdout; |
972 | | - struct timer *expired; |
973 | 971 | struct jsonrpc_request *req; |
974 | 972 | plugins->pending_manifests = 0; |
975 | 973 | uintmap_init(&plugins->pending_requests); |
@@ -1009,19 +1007,15 @@ void plugins_init(struct plugins *plugins, const char *dev_plugin_debug) |
1009 | 1007 | p->timeout_timer = NULL; |
1010 | 1008 | else { |
1011 | 1009 | p->timeout_timer |
1012 | | - = new_reltimer(&plugins->timers, p, |
| 1010 | + = new_reltimer(plugins->ld->timers, p, |
1013 | 1011 | time_from_sec(PLUGIN_MANIFEST_TIMEOUT), |
1014 | 1012 | plugin_manifest_timeout, p); |
1015 | 1013 | } |
1016 | 1014 | tal_free(cmd); |
1017 | 1015 | } |
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); |
1025 | 1019 | } |
1026 | 1020 |
|
1027 | 1021 | static void plugin_config_cb(const char *buffer, |
|
0 commit comments