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

Function rpc_conn_read_response

plugins/libplugin.c:1378–1410  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1376
1377
1378static struct io_plan *rpc_conn_read_response(struct io_conn *conn,
1379 struct plugin *plugin)
1380{
1381 const tal_t *working_ctx = tal(NULL, char);
1382
1383 /* Gather an parse any new bytes */
1384 for (;;) {
1385 const jsmntok_t *toks;
1386 const char *buf;
1387 const char *err;
1388
1389 err = jsonrpc_io_parse(tmpctx,
1390 plugin->jsonrpc_in,
1391 &toks, &buf);
1392 if (err)
1393 plugin_err(plugin, "%s", err);
1394
1395 if (!toks)
1396 break;
1397
1398 handle_rpc_reply(working_ctx, plugin, buf, toks);
1399 jsonrpc_io_parse_done(plugin->jsonrpc_in);
1400 }
1401
1402 /* Explicitly free any expired requests now; xpay uses this to
1403 * fire more commands! */
1404 tal_free(working_ctx);
1405
1406 /* Read more */
1407 return jsonrpc_io_read(conn, plugin->jsonrpc_in,
1408 rpc_conn_read_response,
1409 plugin);
1410}
1411
1412static struct io_plan *rpc_conn_write_request(struct io_conn *conn,
1413 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