We act as if the plugin itself said "I'm dead!" */
| 222 | |
| 223 | /* We act as if the plugin itself said "I'm dead!" */ |
| 224 | static void plugin_terminated_fail_req(struct plugin *plugin, |
| 225 | struct jsonrpc_request *req) |
| 226 | { |
| 227 | jsmntok_t *toks = toks_alloc(plugin); |
| 228 | const jsmntok_t *idtok; |
| 229 | const char *buf; |
| 230 | jsmn_parser parser; |
| 231 | bool complete; |
| 232 | |
| 233 | buf = tal_fmt(plugin, |
| 234 | "{\"jsonrpc\": \"2.0\"," |
| 235 | "\"id\": %s," |
| 236 | "\"error\":" |
| 237 | " {\"code\":%i, \"message\":\"%s\"}" |
| 238 | "}\n\n", |
| 239 | req->id, |
| 240 | PLUGIN_TERMINATED, |
| 241 | "Plugin terminated before replying to RPC call."); |
| 242 | jsmn_init(&parser); |
| 243 | if (!json_parse_input(&parser, &toks, buf, strlen(buf), &complete)) |
| 244 | abort(); |
| 245 | assert(complete); |
| 246 | idtok = json_get_member(buf, toks, "id"); |
| 247 | plugin_response_handle(plugin, buf, toks, idtok); |
| 248 | } |
| 249 | |
| 250 | static void destroy_plugin(struct plugin *p) |
| 251 | { |
no test coverage detected