| 2272 | } |
| 2273 | |
| 2274 | static struct io_plan *ld_read_json(struct io_conn *conn, |
| 2275 | struct plugin *plugin) |
| 2276 | { |
| 2277 | /* Gather an parse any new bytes */ |
| 2278 | for (;;) { |
| 2279 | const jsmntok_t *toks; |
| 2280 | const char *buf; |
| 2281 | const char *err; |
| 2282 | |
| 2283 | err = jsonrpc_io_parse(tmpctx, |
| 2284 | plugin->lightningd_in, |
| 2285 | &toks, &buf); |
| 2286 | if (err) |
| 2287 | plugin_err(plugin, "%s", err); |
| 2288 | |
| 2289 | if (!toks) |
| 2290 | break; |
| 2291 | |
| 2292 | ld_command_handle(plugin, buf, toks); |
| 2293 | jsonrpc_io_parse_done(plugin->lightningd_in); |
| 2294 | } |
| 2295 | |
| 2296 | /* Read more */ |
| 2297 | return jsonrpc_io_read(conn, plugin->lightningd_in, |
| 2298 | ld_read_json, plugin); |
| 2299 | } |
| 2300 | |
| 2301 | static struct io_plan *ld_write_json(struct io_conn *conn, |
| 2302 | struct plugin *plugin); |
no test coverage detected