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