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

Function io_read_wire_

wire/wire_io.c:79–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79struct 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. */
97static int do_write_wire_header(int fd, struct io_plan_arg *arg)

Callers

nothing calls this directly

Calls 2

io_set_planFunction · 0.85
io_plan_argClass · 0.70

Tested by

no test coverage detected