mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
common: move json_stream from lightningd/ to common/
It's not lightningd-specific and we are going to need it for libplugin. The only drawback is the log_io removal in json_stream_output_write()..
This commit is contained in:
@@ -34,6 +34,7 @@ COMMON_SRC_NOGEN := \
|
|||||||
common/io_lock.c \
|
common/io_lock.c \
|
||||||
common/json.c \
|
common/json.c \
|
||||||
common/json_helpers.c \
|
common/json_helpers.c \
|
||||||
|
common/json_stream.c \
|
||||||
common/json_tok.c \
|
common/json_tok.c \
|
||||||
common/key_derive.c \
|
common/key_derive.c \
|
||||||
common/keyset.c \
|
common/keyset.c \
|
||||||
|
|||||||
@@ -6,10 +6,8 @@
|
|||||||
#include <ccan/str/hex/hex.h>
|
#include <ccan/str/hex/hex.h>
|
||||||
#include <ccan/tal/str/str.h>
|
#include <ccan/tal/str/str.h>
|
||||||
#include <common/daemon.h>
|
#include <common/daemon.h>
|
||||||
|
#include <common/json_stream.h>
|
||||||
#include <common/utils.h>
|
#include <common/utils.h>
|
||||||
#include <lightningd/json.h>
|
|
||||||
#include <lightningd/json_stream.h>
|
|
||||||
#include <lightningd/log.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@@ -208,8 +206,6 @@ static struct io_plan *json_stream_output_write(struct io_conn *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
js->reader = conn;
|
js->reader = conn;
|
||||||
if (js->log)
|
|
||||||
log_io(js->log, LOG_IO_OUT, NULL, "", p, js->len_read);
|
|
||||||
return io_write(conn,
|
return io_write(conn,
|
||||||
p, js->len_read,
|
p, js->len_read,
|
||||||
json_stream_output_write, js);
|
json_stream_output_write, js);
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
/* lightningd/json_stream.h
|
/* lightningd/json_stream.h
|
||||||
* Helpers for outputting JSON results into a membuf.
|
* Helpers for outputting JSON results into a membuf.
|
||||||
*/
|
*/
|
||||||
#ifndef LIGHTNING_LIGHTNINGD_JSON_STREAM_H
|
#ifndef LIGHTNING_COMMON_JSON_STREAM_H
|
||||||
#define LIGHTNING_LIGHTNINGD_JSON_STREAM_H
|
#define LIGHTNING_COMMON_JSON_STREAM_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <ccan/membuf/membuf.h>
|
#include <ccan/membuf/membuf.h>
|
||||||
#include <ccan/short_types/short_types.h>
|
#include <ccan/short_types/short_types.h>
|
||||||
@@ -131,4 +131,4 @@ struct io_plan *json_stream_output_(struct json_stream *js,
|
|||||||
|
|
||||||
void json_stream_flush(struct json_stream *js);
|
void json_stream_flush(struct json_stream *js);
|
||||||
|
|
||||||
#endif /* LIGHTNING_LIGHTNINGD_JSON_STREAM_H */
|
#endif /* LIGHTNING_COMMON_JSON_STREAM_H */
|
||||||
@@ -42,6 +42,7 @@ LIGHTNINGD_COMMON_OBJS := \
|
|||||||
common/io_lock.o \
|
common/io_lock.o \
|
||||||
common/json.o \
|
common/json.o \
|
||||||
common/json_helpers.o \
|
common/json_helpers.o \
|
||||||
|
common/json_stream.o \
|
||||||
common/json_tok.o \
|
common/json_tok.o \
|
||||||
common/memleak.o \
|
common/memleak.o \
|
||||||
common/msg_queue.o \
|
common/msg_queue.o \
|
||||||
@@ -81,7 +82,6 @@ LIGHTNINGD_SRC := \
|
|||||||
lightningd/invoice.c \
|
lightningd/invoice.c \
|
||||||
lightningd/io_loop_with_timers.c \
|
lightningd/io_loop_with_timers.c \
|
||||||
lightningd/json.c \
|
lightningd/json.c \
|
||||||
lightningd/json_stream.c \
|
|
||||||
lightningd/jsonrpc.c \
|
lightningd/jsonrpc.c \
|
||||||
lightningd/lightningd.c \
|
lightningd/lightningd.c \
|
||||||
lightningd/log.c \
|
lightningd/log.c \
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <common/features.h>
|
#include <common/features.h>
|
||||||
#include <common/json_command.h>
|
#include <common/json_command.h>
|
||||||
#include <common/json_helpers.h>
|
#include <common/json_helpers.h>
|
||||||
|
#include <common/json_stream.h>
|
||||||
#include <common/jsonrpc_errors.h>
|
#include <common/jsonrpc_errors.h>
|
||||||
#include <common/memleak.h>
|
#include <common/memleak.h>
|
||||||
#include <common/node_id.h>
|
#include <common/node_id.h>
|
||||||
@@ -21,7 +22,6 @@
|
|||||||
#include <lightningd/connect_control.h>
|
#include <lightningd/connect_control.h>
|
||||||
#include <lightningd/hsm_control.h>
|
#include <lightningd/hsm_control.h>
|
||||||
#include <lightningd/json.h>
|
#include <lightningd/json.h>
|
||||||
#include <lightningd/json_stream.h>
|
|
||||||
#include <lightningd/jsonrpc.h>
|
#include <lightningd/jsonrpc.h>
|
||||||
#include <lightningd/lightningd.h>
|
#include <lightningd/lightningd.h>
|
||||||
#include <lightningd/log.h>
|
#include <lightningd/log.h>
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <common/json.h>
|
#include <common/json.h>
|
||||||
#include <common/json_command.h>
|
#include <common/json_command.h>
|
||||||
#include <common/json_helpers.h>
|
#include <common/json_helpers.h>
|
||||||
|
#include <common/json_stream.h>
|
||||||
#include <common/jsonrpc_errors.h>
|
#include <common/jsonrpc_errors.h>
|
||||||
#include <common/memleak.h>
|
#include <common/memleak.h>
|
||||||
#include <common/node_id.h>
|
#include <common/node_id.h>
|
||||||
@@ -21,7 +22,6 @@
|
|||||||
#include <gossipd/routing.h>
|
#include <gossipd/routing.h>
|
||||||
#include <lightningd/chaintopology.h>
|
#include <lightningd/chaintopology.h>
|
||||||
#include <lightningd/json.h>
|
#include <lightningd/json.h>
|
||||||
#include <lightningd/json_stream.h>
|
|
||||||
#include <lightningd/jsonrpc.h>
|
#include <lightningd/jsonrpc.h>
|
||||||
#include <lightningd/options.h>
|
#include <lightningd/options.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <ccan/list/list.h>
|
#include <ccan/list/list.h>
|
||||||
#include <common/errcode.h>
|
#include <common/errcode.h>
|
||||||
#include <common/json.h>
|
#include <common/json.h>
|
||||||
#include <lightningd/json_stream.h>
|
#include <common/json_stream.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
struct jsonrpc;
|
struct jsonrpc;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <ccan/autodata/autodata.h>
|
#include <ccan/autodata/autodata.h>
|
||||||
#include <ccan/tal/tal.h>
|
#include <ccan/tal/tal.h>
|
||||||
#include <ccan/typesafe_cb/typesafe_cb.h>
|
#include <ccan/typesafe_cb/typesafe_cb.h>
|
||||||
#include <lightningd/json_stream.h>
|
#include <common/json_stream.h>
|
||||||
#include <lightningd/lightningd.h>
|
#include <lightningd/lightningd.h>
|
||||||
#include <lightningd/plugin.h>
|
#include <lightningd/plugin.h>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "../json_stream.c"
|
#include "../../common/json_stream.c"
|
||||||
#include "../jsonrpc.c"
|
#include "../jsonrpc.c"
|
||||||
#include "../json.c"
|
#include "../json.c"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user