Returns true if it finished all the hooks (and thus didn't call anything) */
| 342 | |
| 343 | /* Returns true if it finished all the hooks (and thus didn't call anything) */ |
| 344 | static bool plugin_hook_call_next(struct plugin_hook_request *ph_req) |
| 345 | { |
| 346 | struct jsonrpc_request *req; |
| 347 | const struct plugin_hook *hook = ph_req->hook; |
| 348 | struct plugin *plugin; |
| 349 | |
| 350 | /* Find next non-NULL hook: call final if we're done */ |
| 351 | do { |
| 352 | ph_req->hook_index++; |
| 353 | if (ph_req->hook_index >= tal_count(hook->hooks)) { |
| 354 | hook_done(ph_req->ld, ph_req->hook, ph_req->cb_arg); |
| 355 | tal_free(ph_req); |
| 356 | return true; |
| 357 | } |
| 358 | } while (!hook_callable(hook->hooks[ph_req->hook_index], |
| 359 | ph_req->strfilterfield, |
| 360 | ph_req->intfilterfield)); |
| 361 | |
| 362 | plugin = hook->hooks[ph_req->hook_index]->plugin; |
| 363 | log_trace(ph_req->ld->log, "Calling %s hook of plugin %s", |
| 364 | ph_req->hook->name, plugin->shortname); |
| 365 | req = jsonrpc_request_start(NULL, hook->name, ph_req->cmd_id, |
| 366 | plugin_get_logger(plugin), |
| 367 | NULL, |
| 368 | plugin_hook_callback, ph_req); |
| 369 | |
| 370 | hook->serialize_payload(ph_req->cb_arg, req->stream, plugin); |
| 371 | jsonrpc_request_end(req); |
| 372 | |
| 373 | dev_save_plugin_io_out(plugin->plugins, |
| 374 | "hook_out", hook->name, |
| 375 | req->stream); |
| 376 | |
| 377 | plugin_request_send(plugin, req); |
| 378 | return false; |
| 379 | } |
| 380 | |
| 381 | bool plugin_hook_call_(struct lightningd *ld, |
| 382 | struct plugin_hook *hook, |
no test coverage detected