| 1302 | } |
| 1303 | |
| 1304 | static struct command_result *plugin_rpcmethod_dispatch(struct command *cmd, |
| 1305 | const char *buffer, |
| 1306 | const jsmntok_t *toks, |
| 1307 | const jsmntok_t *params UNNEEDED) |
| 1308 | { |
| 1309 | const jsmntok_t *idtok; |
| 1310 | struct plugin *plugin; |
| 1311 | struct jsonrpc_request *req; |
| 1312 | bool cmd_ok; |
| 1313 | |
| 1314 | plugin = find_plugin_for_command(cmd->ld, cmd->json_cmd->name); |
| 1315 | if (!plugin) |
| 1316 | fatal("No plugin for %s ?", cmd->json_cmd->name); |
| 1317 | |
| 1318 | /* This should go to plugin_rpcmethod_check! */ |
| 1319 | assert(!command_check_only(cmd)); |
| 1320 | |
| 1321 | /* Find ID again (We've parsed them before, this should not fail!) */ |
| 1322 | idtok = json_get_member(buffer, toks, "id"); |
| 1323 | assert(idtok != NULL); |
| 1324 | |
| 1325 | /* If they've changed deprecation status for this cmd, tell plugin */ |
| 1326 | cmd_ok = command_deprecated_ok_flag(cmd); |
| 1327 | if (cmd_ok != cmd->ld->deprecated_ok) { |
| 1328 | if (!notify_deprecated_oneshot(cmd->ld, plugin, cmd_ok)) { |
| 1329 | log_debug(plugin->log, |
| 1330 | "Plugin does not support deprecation setting for cmd %s (id %s)", |
| 1331 | cmd->json_cmd->name, cmd->id); |
| 1332 | } |
| 1333 | } |
| 1334 | req = jsonrpc_request_start_raw(plugin, cmd->json_cmd->name, |
| 1335 | cmd->id, |
| 1336 | plugin->log, |
| 1337 | plugin_notify_cb, |
| 1338 | plugin_rpcmethod_cb, cmd); |
| 1339 | |
| 1340 | json_stream_forward_change_id(req->stream, buffer, toks, idtok, req->id); |
| 1341 | json_stream_double_cr(req->stream); |
| 1342 | plugin_request_send(plugin, req); |
| 1343 | req->stream = NULL; |
| 1344 | |
| 1345 | return command_still_pending(cmd); |
| 1346 | } |
| 1347 | |
| 1348 | static const char *plugin_rpcmethod_add(struct plugin *plugin, |
| 1349 | const char *buffer, |
nothing calls this directly
no test coverage detected