| 629 | } |
| 630 | |
| 631 | static struct command_result *command_exec(struct json_connection *jcon, |
| 632 | struct command *cmd, |
| 633 | const char *buffer, |
| 634 | const jsmntok_t *request, |
| 635 | const jsmntok_t *params) |
| 636 | { |
| 637 | struct command_result *res; |
| 638 | |
| 639 | res = cmd->json_cmd->dispatch(cmd, buffer, request, params); |
| 640 | |
| 641 | assert(res == ¶m_failed |
| 642 | || res == &complete |
| 643 | || res == &pending |
| 644 | || res == &unknown); |
| 645 | |
| 646 | /* If they didn't complete it, they must call command_still_pending. |
| 647 | * If they completed it, it's freed already. */ |
| 648 | if (res == &pending) |
| 649 | assert(cmd->pending); |
| 650 | |
| 651 | /* The command might outlive the connection. */ |
| 652 | if (jcon) |
| 653 | list_for_each(&jcon->commands, cmd, list) |
| 654 | assert(cmd->pending); |
| 655 | |
| 656 | return res; |
| 657 | } |
| 658 | |
| 659 | /* A plugin hook to take over (fail/alter) RPC commands */ |
| 660 | struct rpc_command_hook_payload { |
no outgoing calls
no test coverage detected