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

Function plugins_notify

lightningd/plugin.c:2465–2505  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2463}
2464
2465void plugins_notify(struct plugins *plugins,
2466 const struct jsonrpc_notification *n TAKES)
2467{
2468 struct plugin_subscription_htable_iter it;
2469
2470 if (taken(n))
2471 tal_steal(tmpctx, n);
2472
2473 /* If we're shutting down, ld->plugins will be NULL */
2474 if (!plugins)
2475 return;
2476
2477 dev_save_plugin_io_out(plugins,
2478 "notification_out",
2479 n->method, n->stream);
2480
2481 for (struct plugin_subscription *sub
2482 = plugin_subscription_htable_getfirst(plugins->subscriptions,
2483 n->method, &it);
2484 sub != NULL;
2485 sub = plugin_subscription_htable_getnext(plugins->subscriptions,
2486 n->method, &it)) {
2487 if (sub->owner->plugin_state != INIT_COMPLETE)
2488 continue;
2489 plugin_send(sub->owner, json_stream_dup(sub->owner, n->stream, sub->owner->log));
2490 }
2491
2492 /* "log" doesn't go to wildcards */
2493 if (!streq(n->method, "log")) {
2494 for (struct plugin_subscription *sub
2495 = plugin_subscription_htable_getfirst(plugins->subscriptions,
2496 "*", &it);
2497 sub != NULL;
2498 sub = plugin_subscription_htable_getnext(plugins->subscriptions,
2499 "*", &it)) {
2500 if (sub->owner->plugin_state != INIT_COMPLETE)
2501 continue;
2502 plugin_send(sub->owner, json_stream_dup(sub->owner, n->stream, sub->owner->log));
2503 }
2504 }
2505}
2506
2507void plugin_request_send(struct plugin *plugin,
2508 struct jsonrpc_request *req)

Callers 2

notify_sendFunction · 0.85

Calls 4

takenFunction · 0.85
dev_save_plugin_io_outFunction · 0.85
plugin_sendFunction · 0.85
json_stream_dupFunction · 0.85

Tested by

no test coverage detected