| 1262 | } |
| 1263 | |
| 1264 | static struct command_result *plugin_rpcmethod_check(struct command *cmd, |
| 1265 | const char *buffer, |
| 1266 | const jsmntok_t *toks, |
| 1267 | const jsmntok_t *params) |
| 1268 | { |
| 1269 | const jsmntok_t *idtok; |
| 1270 | struct plugin *plugin; |
| 1271 | struct jsonrpc_request *req; |
| 1272 | |
| 1273 | plugin = find_plugin_for_command(cmd->ld, cmd->json_cmd->name); |
| 1274 | if (!plugin) |
| 1275 | fatal("No plugin for %s ?", cmd->json_cmd->name); |
| 1276 | |
| 1277 | assert(command_check_only(cmd)); |
| 1278 | |
| 1279 | if (!plugin->can_check) { |
| 1280 | log_unusual(plugin->log, "Plugin does not support check command for %s (id %s)", |
| 1281 | cmd->json_cmd->name, cmd->id); |
| 1282 | return command_check_done(cmd); |
| 1283 | } |
| 1284 | |
| 1285 | /* Find id again (we've parsed them before, this should not fail!) */ |
| 1286 | idtok = json_get_member(buffer, toks, "id"); |
| 1287 | assert(idtok != NULL); |
| 1288 | |
| 1289 | /* Send check command through, it says it can handle it! */ |
| 1290 | req = jsonrpc_request_start_raw(plugin, "check", |
| 1291 | cmd->id, |
| 1292 | plugin->log, |
| 1293 | plugin_notify_cb, |
| 1294 | plugin_rpcmethod_cb, cmd); |
| 1295 | |
| 1296 | json_stream_forward_change_id(req->stream, buffer, toks, idtok, req->id); |
| 1297 | json_stream_double_cr(req->stream); |
| 1298 | plugin_request_send(plugin, req); |
| 1299 | req->stream = NULL; |
| 1300 | |
| 1301 | return command_still_pending(cmd); |
| 1302 | } |
| 1303 | |
| 1304 | static struct command_result *plugin_rpcmethod_dispatch(struct command *cmd, |
| 1305 | const char *buffer, |
nothing calls this directly
no test coverage detected