| 77 | } |
| 78 | |
| 79 | struct io_plan *io_read_wire_(struct io_conn *conn, |
| 80 | const tal_t *ctx, |
| 81 | u8 **data, |
| 82 | struct io_plan *(*next)(struct io_conn *, void *), |
| 83 | void *next_arg) |
| 84 | { |
| 85 | struct io_plan_arg *arg = io_plan_arg(conn, IO_IN); |
| 86 | |
| 87 | /* We allocate data now; saves storing ctx, and lets us read in len. */ |
| 88 | arg->u1.vp = data; |
| 89 | *data = tal_arr(ctx, u8, HEADER_LEN); |
| 90 | |
| 91 | /* We use u2 to store the length we've read. */ |
| 92 | arg->u2.s = INSIDE_HEADER_BIT; |
| 93 | return io_set_plan(conn, IO_IN, do_read_wire, next, next_arg); |
| 94 | } |
| 95 | |
| 96 | /* arg->u2.s contains length we've written, arg->u1 contains u8 *data. */ |
| 97 | static int do_write_wire_header(int fd, struct io_plan_arg *arg) |
nothing calls this directly
no test coverage detected