Browse Source

plugin: Start each plugin and setup the connection to it

plugin-1
Christian Decker 7 years ago
parent
commit
2964f75604
No known key found for this signature in database GPG Key ID: 1416D83DC4F0E86D
  1. 4
      lightningd/lightningd.c
  2. 7
      lightningd/plugin.c
  3. 3
      lightningd/test/run-find_my_abspath.c

4
lightningd/lightningd.c

@ -596,6 +596,10 @@ int main(int argc, char *argv[])
/*~ Handle options and config; move to .lightningd (--lightning-dir) */
handle_opts(ld, argc, argv);
/*~ Initialize all the plugins we just registered, so they can do their
* thing and tell us about themselves */
plugins_init(ld->plugins);
/*~ Make sure we can reach the subdaemons, and versions match. */
test_subdaemons(ld);

7
lightningd/plugin.c

@ -1,6 +1,7 @@
#include "lightningd/plugin.h"
#include <ccan/list/list.h>
#include <ccan/pipecmd/pipecmd.h>
#include <ccan/tal/str/str.h>
#include <lightningd/json.h>
#include <unistd.h>
@ -33,6 +34,12 @@ void plugin_register(struct plugins *plugins, const char* path TAKES)
void plugins_init(struct plugins *plugins)
{
struct plugin *p;
/* Spawn the plugin processes before entering the io_loop */
for (size_t i=0; i<tal_count(plugins->plugins); i++) {
p = &plugins->plugins[i];
p->pid = pipecmd(&p->stdout, &p->stdin, NULL, p->cmd);
}
}
void json_add_opt_plugins(struct json_stream *response,

3
lightningd/test/run-find_my_abspath.c

@ -119,6 +119,9 @@ struct chain_topology *new_topology(struct lightningd *ld UNNEEDED, struct log *
/* Generated stub for onchaind_replay_channels */
void onchaind_replay_channels(struct lightningd *ld UNNEEDED)
{ fprintf(stderr, "onchaind_replay_channels called!\n"); abort(); }
/* Generated stub for plugins_init */
void plugins_init(struct plugins *plugins UNNEEDED)
{ fprintf(stderr, "plugins_init called!\n"); abort(); }
/* Generated stub for plugins_new */
struct plugins *plugins_new(const tal_t *ctx UNNEEDED)
{ fprintf(stderr, "plugins_new called!\n"); abort(); }

Loading…
Cancel
Save