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

Function json_stream_output_write

common/json_stream.c:239–263  ·  view source on GitHub ↗

This is where we read the json_stream and write it to conn */

Source from the content-addressed store, hash-verified

237
238/* This is where we read the json_stream and write it to conn */
239static struct io_plan *json_stream_output_write(struct io_conn *conn,
240 struct json_stream *js)
241{
242 const char *p;
243
244 /* For when we've just done some output */
245 json_out_consume(js->jout, js->len_read);
246
247 /* Get how much we can write out from js */
248 p = json_out_contents(js->jout, &js->len_read);
249
250 /* Nothing in buffer? */
251 if (!p) {
252 /* We're not doing io_write now, unset. */
253 js->reader = NULL;
254 if (!json_stream_still_writing(js))
255 return js->reader_cb(conn, js, js->reader_arg);
256 return io_out_wait(conn, js, json_stream_output_write, js);
257 }
258
259 js->reader = conn;
260 return io_write(conn,
261 p, js->len_read,
262 json_stream_output_write, js);
263}
264
265struct io_plan *json_stream_output_(struct json_stream *js,
266 struct io_conn *conn,

Callers 1

json_stream_output_Function · 0.85

Calls 3

json_out_consumeFunction · 0.85
json_out_contentsFunction · 0.85

Tested by

no test coverage detected