MCPcopy Create free account
hub / github.com/ElementsProject/lightning / plugin_main

Function plugin_main

plugins/libplugin.c:2443–2496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2441}
2442
2443void plugin_main(char *argv[],
2444 const char *(*init)(struct command *init_cmd,
2445 const char *buf, const jsmntok_t *),
2446 void *data,
2447 const enum plugin_restartability restartability,
2448 bool init_rpc,
2449 struct feature_set *features STEALS,
2450 const struct plugin_command *commands TAKES,
2451 size_t num_commands,
2452 const struct plugin_notification *notif_subs TAKES,
2453 size_t num_notif_subs,
2454 const struct plugin_hook *hook_subs TAKES,
2455 size_t num_hook_subs,
2456 const char **notif_topics TAKES,
2457 size_t num_notif_topics,
2458 ...)
2459{
2460 struct plugin *plugin;
2461 va_list ap;
2462 bool developer;
2463
2464 setup_locale();
2465
2466 developer = daemon_developer_mode(argv);
2467
2468 /* Note this already prints to stderr, which is enough for now */
2469 daemon_setup(argv[0], NULL, NULL);
2470
2471 va_start(ap, num_notif_topics);
2472 plugin = new_plugin(NULL, argv[0], developer,
2473 init, restartability, init_rpc, features, commands,
2474 num_commands, notif_subs, num_notif_subs, hook_subs,
2475 num_hook_subs, notif_topics, num_notif_topics, ap);
2476 plugin_set_data(plugin, data);
2477 va_end(ap);
2478 setup_command_usage(plugin);
2479
2480 timers_init(&plugin->timers, time_mono());
2481
2482 io_new_conn(plugin, STDIN_FILENO, stdin_conn_init, plugin);
2483 io_new_conn(plugin, STDOUT_FILENO, stdout_conn_init, plugin);
2484
2485 for (;;) {
2486 struct timer *expired = NULL;
2487
2488 clean_tmpctx();
2489
2490 /* Will only exit if a timer has expired. */
2491 io_loop(&plugin->timers, &expired);
2492 call_plugin_timer(plugin, expired);
2493 }
2494
2495 tal_free(plugin);
2496}
2497
2498static struct listpeers_channel *json_to_listpeers_channel(const tal_t *ctx,
2499 const char *buffer,

Callers 15

mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70
mainFunction · 0.70

Calls 12

setup_localeFunction · 0.85
daemon_developer_modeFunction · 0.85
daemon_setupFunction · 0.85
new_pluginFunction · 0.85
plugin_set_dataFunction · 0.85
timers_initFunction · 0.85
time_monoFunction · 0.85
clean_tmpctxFunction · 0.85
io_loopFunction · 0.85
call_plugin_timerFunction · 0.85
tal_freeFunction · 0.85
setup_command_usageFunction · 0.70

Tested by 1

mainFunction · 0.40