This is where we read the json_stream and write it to conn */
| 237 | |
| 238 | /* This is where we read the json_stream and write it to conn */ |
| 239 | static 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 | |
| 265 | struct io_plan *json_stream_output_(struct json_stream *js, |
| 266 | struct io_conn *conn, |
no test coverage detected