libplugin: use ccan/io for async Rpc requests

This commit is contained in:
darosior
2020-01-26 23:54:33 +01:00
committed by Rusty Russell
parent 765626875e
commit c765a223f1
2 changed files with 176 additions and 39 deletions

View File

@@ -3,7 +3,8 @@
#define LIGHTNING_PLUGINS_LIBPLUGIN_H
#include "config.h"
#include <ccan/ccan/membuf/membuf.h>
#include <ccan/intmap/intmap.h>
#include <ccan/membuf/membuf.h>
#include <ccan/strmap/strmap.h>
#include <ccan/time/time.h>
#include <ccan/timer/timer.h>
@@ -39,8 +40,19 @@ struct plugin {
/* To write to lightningd */
struct json_stream **js_arr;
/* Asynchronous RPC interaction */
struct io_conn *io_rpc_conn;
struct json_stream **rpc_js_arr;
char *rpc_buffer;
size_t rpc_used, rpc_len_read;
/* Tracking async RPC requests */
UINTMAP(struct out_req *) out_reqs;
u64 next_outreq_id;
/* Synchronous RPC interaction */
struct rpc_conn rpc_conn;
/* Plugin informations */
enum plugin_restartability restartability;
const struct plugin_command *commands;
size_t num_commands;