MCPcopy Create free account
hub / github.com/ElementsProject/lightning / rpc_conn_read_response

Function rpc_conn_read_response

plugins/libplugin.c:1388–1420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1386
1387
1388static struct io_plan *rpc_conn_read_response(struct io_conn *conn,
1389 struct plugin *plugin)
1390{
1391 const tal_t *working_ctx = tal(NULL, char);
1392
1393 /* Gather an parse any new bytes */
1394 for (;;) {
1395 const jsmntok_t *toks;
1396 const char *buf;
1397 const char *err;
1398
1399 err = jsonrpc_io_parse(tmpctx,
1400 plugin->jsonrpc_in,
1401 &toks, &buf);
1402 if (err)
1403 plugin_err(plugin, "%s", err);
1404
1405 if (!toks)
1406 break;
1407
1408 handle_rpc_reply(working_ctx, plugin, buf, toks);
1409 jsonrpc_io_parse_done(plugin->jsonrpc_in);
1410 }
1411
1412 /* Explicitly free any expired requests now; xpay uses this to
1413 * fire more commands! */
1414 tal_free(working_ctx);
1415
1416 /* Read more */
1417 return jsonrpc_io_read(conn, plugin->jsonrpc_in,
1418 rpc_conn_read_response,
1419 plugin);
1420}
1421
1422static struct io_plan *rpc_conn_write_request(struct io_conn *conn,
1423 struct plugin *plugin);

Callers 1

rpc_conn_initFunction · 0.85

Calls 5

jsonrpc_io_parseFunction · 0.85
handle_rpc_replyFunction · 0.85
jsonrpc_io_parse_doneFunction · 0.85
tal_freeFunction · 0.85
plugin_errFunction · 0.70

Tested by

no test coverage detected