| 2475 | } |
| 2476 | |
| 2477 | void plugins_notify(struct plugins *plugins, |
| 2478 | const struct jsonrpc_notification *n TAKES) |
| 2479 | { |
| 2480 | struct plugin_subscription_htable_iter it; |
| 2481 | |
| 2482 | if (taken(n)) |
| 2483 | tal_steal(tmpctx, n); |
| 2484 | |
| 2485 | /* If we're shutting down, ld->plugins will be NULL */ |
| 2486 | if (!plugins) |
| 2487 | return; |
| 2488 | |
| 2489 | dev_save_plugin_io_out(plugins, |
| 2490 | "notification_out", |
| 2491 | n->method, n->stream); |
| 2492 | |
| 2493 | for (struct plugin_subscription *sub |
| 2494 | = plugin_subscription_htable_getfirst(plugins->subscriptions, |
| 2495 | n->method, &it); |
| 2496 | sub != NULL; |
| 2497 | sub = plugin_subscription_htable_getnext(plugins->subscriptions, |
| 2498 | n->method, &it)) { |
| 2499 | if (sub->owner->plugin_state != INIT_COMPLETE) |
| 2500 | continue; |
| 2501 | plugin_send(sub->owner, json_stream_dup(sub->owner, n->stream, sub->owner->log)); |
| 2502 | } |
| 2503 | |
| 2504 | /* "log" doesn't go to wildcards */ |
| 2505 | if (!streq(n->method, "log")) { |
| 2506 | for (struct plugin_subscription *sub |
| 2507 | = plugin_subscription_htable_getfirst(plugins->subscriptions, |
| 2508 | "*", &it); |
| 2509 | sub != NULL; |
| 2510 | sub = plugin_subscription_htable_getnext(plugins->subscriptions, |
| 2511 | "*", &it)) { |
| 2512 | if (sub->owner->plugin_state != INIT_COMPLETE) |
| 2513 | continue; |
| 2514 | plugin_send(sub->owner, json_stream_dup(sub->owner, n->stream, sub->owner->log)); |
| 2515 | } |
| 2516 | } |
| 2517 | } |
| 2518 | |
| 2519 | void plugin_request_send(struct plugin *plugin, |
| 2520 | struct jsonrpc_request *req) |
no test coverage detected