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

Function plugin_main

plugins/libplugin.c:2433–2486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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