| 2463 | } |
| 2464 | |
| 2465 | void 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 | |
| 2507 | void plugin_request_send(struct plugin *plugin, |
| 2508 | struct jsonrpc_request *req) |
no test coverage detected