Browse Source
This is just copying most of gossipd/gossip.c into connectd/connect.c. It shares the same wire format as gossipd during transition, and changes are deliberately minimal. It also has an additional message 'connect_reconnected' which it sends to the master daemon to tell it to kill a peer; gossipd relied on closing the gossipfd to do this, but connectd doesn't maintain an fd with remote peers. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>ppa-0.6.1
Rusty Russell
7 years ago
7 changed files with 2066 additions and 0 deletions
@ -0,0 +1,99 @@ |
|||
#! /usr/bin/make
|
|||
|
|||
# Designed to be run one level up
|
|||
connectd-wrongdir: |
|||
$(MAKE) -C .. connectd-all |
|||
|
|||
default: connectd-all |
|||
|
|||
# Control daemon uses this:
|
|||
LIGHTNINGD_CONNECT_CONTROL_HEADERS := connectd/gen_connect_wire.h connectd/gen_connect_gossip_wire.h |
|||
LIGHTNINGD_CONNECT_CONTROL_SRC := connectd/gen_connect_wire.c connectd/gen_connect_gossip_wire.c |
|||
LIGHTNINGD_CONNECT_CONTROL_OBJS := $(LIGHTNINGD_CONNECT_CONTROL_SRC:.c=.o) |
|||
|
|||
# connectd needs these:
|
|||
LIGHTNINGD_CONNECT_HEADERS := connectd/gen_connect_wire.h \
|
|||
connectd/gen_connect_gossip_wire.h \
|
|||
connectd/connect.h \
|
|||
gossipd/handshake.h \
|
|||
gossipd/netaddress.h \
|
|||
gossipd/tor_autoservice.h \
|
|||
gossipd/tor.h |
|||
LIGHTNINGD_CONNECT_SRC := $(LIGHTNINGD_CONNECT_HEADERS:.h=.c) |
|||
LIGHTNINGD_CONNECT_OBJS := $(LIGHTNINGD_CONNECT_SRC:.c=.o) |
|||
|
|||
# Make sure these depend on everything.
|
|||
ALL_OBJS += $(LIGHTNINGD_CONNECT_OBJS) |
|||
ALL_PROGRAMS += lightningd/lightning_connectd |
|||
ALL_GEN_HEADERS += connectd/gen_connect_wire.h connectd/gen_connect_gossip_wire.h |
|||
|
|||
# For checking
|
|||
LIGHTNINGD_CONNECT_ALLSRC_NOGEN := $(filter-out connectd/gen_%, $(LIGHTNINGD_CONNECT_CLIENT_SRC) $(LIGHTNINGD_CONNECT_SRC)) |
|||
LIGHTNINGD_CONNECT_ALLHEADERS_NOGEN := $(filter-out connectd/gen_%, $(LIGHTNINGD_CONNECT_CLIENT_HEADERS) $(LIGHTNINGD_CONNECT_HEADERS)) |
|||
|
|||
# Add to headers which any object might need.
|
|||
LIGHTNINGD_HEADERS_GEN += $(LIGHTNINGD_CONNECT_HEADERS) |
|||
|
|||
# Common source we use.
|
|||
CONNECTD_COMMON_OBJS := \
|
|||
common/base32.o \
|
|||
common/bech32.o \
|
|||
common/bech32_util.o \
|
|||
common/bip32.o \
|
|||
common/crypto_state.o \
|
|||
common/crypto_sync.o \
|
|||
common/cryptomsg.o \
|
|||
common/daemon.o \
|
|||
common/daemon_conn.o \
|
|||
common/derive_basepoints.o \
|
|||
common/dev_disconnect.o \
|
|||
common/features.o \
|
|||
common/gen_status_wire.o \
|
|||
common/msg_queue.o \
|
|||
common/pseudorand.o \
|
|||
common/status.o \
|
|||
common/status_wire.o \
|
|||
common/subdaemon.o \
|
|||
common/timeout.o \
|
|||
common/type_to_string.o \
|
|||
common/utils.o \
|
|||
common/utxo.o \
|
|||
common/version.o \
|
|||
common/wireaddr.o \
|
|||
common/wire_error.o \
|
|||
gossipd/gen_gossip_wire.o \
|
|||
hsmd/client.o \
|
|||
hsmd/gen_hsm_client_wire.o \
|
|||
lightningd/gossip_msg.o \
|
|||
wire/gen_onion_wire.o |
|||
|
|||
$(LIGHTNINGD_CONNECT_OBJS): $(LIGHTNINGD_HEADERS) $(LIGHTNINGD_CONNECT_HEADERS) |
|||
|
|||
$(LIGHTNINGD_CONNECT_CONTROL_OBJS) : $(LIGHTNINGD_CONNECT_CONTROL_HEADERS) |
|||
|
|||
connectd-all: lightningd/lightning_connectd |
|||
|
|||
lightningd/lightning_connectd: $(LIGHTNINGD_CONNECT_OBJS) $(CONNECTD_COMMON_OBJS) $(BITCOIN_OBJS) $(WIRE_OBJS) |
|||
|
|||
connectd/gen_connect_wire.h: $(WIRE_GEN) connectd/connect_wire.csv |
|||
$(WIRE_GEN) --header $@ connect_wire_type < connectd/connect_wire.csv > $@ |
|||
|
|||
connectd/gen_connect_wire.c: $(WIRE_GEN) connectd/connect_wire.csv |
|||
$(WIRE_GEN) ${@:.c=.h} connect_wire_type < connectd/connect_wire.csv > $@ |
|||
|
|||
connectd/gen_connect_gossip_wire.h: $(WIRE_GEN) connectd/connect_gossip_wire.csv |
|||
$(WIRE_GEN) --header $@ connect_gossip_wire_type < connectd/connect_gossip_wire.csv > $@ |
|||
|
|||
connectd/gen_connect_gossip_wire.c: $(WIRE_GEN) connectd/connect_gossip_wire.csv |
|||
$(WIRE_GEN) ${@:.c=.h} connect_gossip_wire_type < connectd/connect_gossip_wire.csv > $@ |
|||
|
|||
check-source: $(LIGHTNINGD_CONNECT_ALLSRC_NOGEN:%=check-src-include-order/%) $(LIGHTNINGD_CONNECT_ALLHEADERS_NOGEN:%=check-hdr-include-order/%) |
|||
check-source-bolt: $(LIGHTNINGD_CONNECT_SRC:%=bolt-check/%) $(LIGHTNINGD_CONNECT_HEADERS:%=bolt-check/%) |
|||
check-whitespace: $(LIGHTNINGD_CONNECT_ALLSRC_NOGEN:%=check-whitespace/%) $(LIGHTNINGD_CONNECT_ALLHEADERS_NOGEN:%=check-whitespace/%) |
|||
|
|||
clean: connectd-clean |
|||
|
|||
connectd-clean: |
|||
$(RM) $(LIGHTNINGD_CONNECT_OBJS) connectd/gen_* |
|||
|
|||
-include connectd/test/Makefile |
File diff suppressed because it is too large
@ -0,0 +1,10 @@ |
|||
#ifndef LIGHTNING_CONNECTD_CONNECT_H |
|||
#define LIGHTNING_CONNECTD_CONNECT_H |
|||
#include "config.h" |
|||
|
|||
struct io_conn; |
|||
struct reaching; |
|||
|
|||
struct io_plan *connection_out(struct io_conn *conn, struct reaching *reach); |
|||
|
|||
#endif /* LIGHTNING_CONNECTD_CONNECT_H */ |
Can't render this file because it has a wrong number of fields in line 2.
|
Can't render this file because it has a wrong number of fields in line 2.
|
Loading…
Reference in new issue