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

Function start_json_stream

lightningd/jsonrpc.c:967–993  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

965 struct json_connection *jcon);
966
967static struct io_plan *start_json_stream(struct io_conn *conn,
968 struct json_connection *jcon)
969{
970 /* If something has created an output buffer, start streaming. */
971 if (tal_count(jcon->js_arr)) {
972 size_t len;
973 const char *p = json_out_contents(jcon->js_arr[0]->jout, &len);
974 if (len)
975 log_io(jcon->log, LOG_IO_OUT, NULL, "", p, len);
976 return json_stream_output(jcon->js_arr[0], conn,
977 stream_out_complete, jcon);
978 }
979
980 /* Tell reader it can run next command. */
981 io_wake(conn);
982
983 /* Once the stop_conn conn is drained, we can shut down. */
984 if (jcon->ld->stop_conn == conn && jcon->ld->state == LD_STATE_RUNNING) {
985 /* Return us to toplevel lightningd.c */
986 log_debug(jcon->ld->log, "io_break: %s", __func__);
987 io_break(jcon->ld);
988 /* We never come back. */
989 return io_out_wait(conn, conn, io_never, conn);
990 }
991
992 return io_out_wait(conn, jcon, start_json_stream, jcon);
993}
994
995/* Command has completed writing, and we've written it all out to conn. */
996static struct io_plan *stream_out_complete(struct io_conn *conn,

Callers 2

stream_out_completeFunction · 0.85
jcon_connectedFunction · 0.85

Calls 4

json_out_contentsFunction · 0.85
io_wakeFunction · 0.85
io_breakFunction · 0.85
log_ioFunction · 0.70

Tested by

no test coverage detected