diff --git a/common/Makefile b/common/Makefile index 192ea4e81..d5a920730 100644 --- a/common/Makefile +++ b/common/Makefile @@ -34,6 +34,7 @@ COMMON_SRC_NOGEN := \ common/io_lock.c \ common/json.c \ common/json_helpers.c \ + common/json_stream.c \ common/json_tok.c \ common/key_derive.c \ common/keyset.c \ diff --git a/lightningd/json_stream.c b/common/json_stream.c similarity index 97% rename from lightningd/json_stream.c rename to common/json_stream.c index b21632d26..1dac5a47e 100644 --- a/lightningd/json_stream.c +++ b/common/json_stream.c @@ -6,10 +6,8 @@ #include #include #include +#include #include -#include -#include -#include #include #include @@ -208,8 +206,6 @@ static struct io_plan *json_stream_output_write(struct io_conn *conn, } js->reader = conn; - if (js->log) - log_io(js->log, LOG_IO_OUT, NULL, "", p, js->len_read); return io_write(conn, p, js->len_read, json_stream_output_write, js); diff --git a/lightningd/json_stream.h b/common/json_stream.h similarity index 96% rename from lightningd/json_stream.h rename to common/json_stream.h index 59a0a91ec..5a43b30f6 100644 --- a/lightningd/json_stream.h +++ b/common/json_stream.h @@ -1,8 +1,8 @@ /* lightningd/json_stream.h * Helpers for outputting JSON results into a membuf. */ -#ifndef LIGHTNING_LIGHTNINGD_JSON_STREAM_H -#define LIGHTNING_LIGHTNINGD_JSON_STREAM_H +#ifndef LIGHTNING_COMMON_JSON_STREAM_H +#define LIGHTNING_COMMON_JSON_STREAM_H #include "config.h" #include #include @@ -131,4 +131,4 @@ struct io_plan *json_stream_output_(struct json_stream *js, void json_stream_flush(struct json_stream *js); -#endif /* LIGHTNING_LIGHTNINGD_JSON_STREAM_H */ +#endif /* LIGHTNING_COMMON_JSON_STREAM_H */ diff --git a/lightningd/Makefile b/lightningd/Makefile index b91cada36..480806594 100644 --- a/lightningd/Makefile +++ b/lightningd/Makefile @@ -42,6 +42,7 @@ LIGHTNINGD_COMMON_OBJS := \ common/io_lock.o \ common/json.o \ common/json_helpers.o \ + common/json_stream.o \ common/json_tok.o \ common/memleak.o \ common/msg_queue.o \ @@ -81,7 +82,6 @@ LIGHTNINGD_SRC := \ lightningd/invoice.c \ lightningd/io_loop_with_timers.c \ lightningd/json.c \ - lightningd/json_stream.c \ lightningd/jsonrpc.c \ lightningd/lightningd.c \ lightningd/log.c \ diff --git a/lightningd/connect_control.c b/lightningd/connect_control.c index bf35d3557..5c2b7e3f0 100644 --- a/lightningd/connect_control.c +++ b/lightningd/connect_control.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/lightningd/json.c b/lightningd/json.c index b5b77c4da..90c129684 100644 --- a/lightningd/json.c +++ b/lightningd/json.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -21,7 +22,6 @@ #include #include #include -#include #include #include #include diff --git a/lightningd/jsonrpc.h b/lightningd/jsonrpc.h index 2d84a8a02..ad3449990 100644 --- a/lightningd/jsonrpc.h +++ b/lightningd/jsonrpc.h @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include struct jsonrpc; diff --git a/lightningd/plugin_hook.h b/lightningd/plugin_hook.h index d5ed4d659..2c4876625 100644 --- a/lightningd/plugin_hook.h +++ b/lightningd/plugin_hook.h @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include diff --git a/lightningd/test/run-jsonrpc.c b/lightningd/test/run-jsonrpc.c index 8078fa82c..e46d2f744 100644 --- a/lightningd/test/run-jsonrpc.c +++ b/lightningd/test/run-jsonrpc.c @@ -1,4 +1,4 @@ -#include "../json_stream.c" +#include "../../common/json_stream.c" #include "../jsonrpc.c" #include "../json.c"