From f4a2c4f8bbb1d634569464d40386fa3e352d8aa2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 19 Oct 2018 11:47:48 +1030 Subject: [PATCH] jsonrpc: helper to move an existing io_write. It's a very ugly one-liner; really ccan/io should have an io_replan for this, but it would have to be written carefully as it makes assumptions currently about plans not changing. In this case, we know it's in io_write, and we're just moving a pointer. Signed-off-by: Rusty Russell --- lightningd/jsonrpc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lightningd/jsonrpc.c b/lightningd/jsonrpc.c index a9201bd91..79751ff1b 100644 --- a/lightningd/jsonrpc.c +++ b/lightningd/jsonrpc.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -53,6 +54,12 @@ static void destroy_jcon(struct json_connection *jcon) tal_free(jcon->log); } +/* FIXME: This, or something prettier (io_replan?) belong in ccan/io! */ +static UNNEEDED void adjust_io_write(struct io_conn *conn, ptrdiff_t delta) +{ + conn->plan[IO_OUT].arg.u1.cp += delta; +} + static void json_help(struct command *cmd, const char *buffer, const jsmntok_t *params);