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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-10-19 11:47:48 +10:30
parent 240abf6c46
commit f4a2c4f8bb

View File

@@ -6,6 +6,7 @@
#include <bitcoin/script.h>
#include <ccan/array_size/array_size.h>
#include <ccan/err/err.h>
#include <ccan/io/backend.h>
#include <ccan/io/io.h>
#include <ccan/str/hex/hex.h>
#include <ccan/tal/str/str.h>
@@ -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);