Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connectd does demux part 1 #4984

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
635e72b
update mocks
rustyrussell Jan 8, 2022
f99d086
connectd: keep timeout timer around so we can disable it.
rustyrussell Jan 8, 2022
9d6466a
pytest: make test_channel_state_changed_unilateral more robust.
rustyrussell Jan 8, 2022
f961e4a
connectd: maintain connection with peer, shuffle data.
rustyrussell Jan 8, 2022
8c05f73
gossipwith: create our own internal sync_crypto functions.
rustyrussell Jan 8, 2022
d322f9c
lightningd: make sure gossipd knows before we update blockheight.
rustyrussell Jan 8, 2022
da36066
connectd: do decryption for peers.
rustyrussell Jan 8, 2022
1e55691
peer_io: replace crypto_sync in daemons, use normal wire messages.
rustyrussell Jan 8, 2022
36f4a75
per_peer_state: remove struct crypto_state
rustyrussell Jan 8, 2022
d215f9e
connectd: do dev_disconnect logic.
rustyrussell Jan 8, 2022
1303733
connectd: do nagle by packet type.
rustyrussell Jan 8, 2022
cc6f91a
common: add routine for absolute timeouts (vs. relative).
rustyrussell Jan 8, 2022
d9f9d39
connectd: serve gossip_store file for the peer.
rustyrussell Jan 8, 2022
e31bccf
subdaemons: don't stream gossip_store at all.
rustyrussell Jan 8, 2022
7555826
patch lightningd-peer-fds.patch
rustyrussell Jan 11, 2022
cd679cc
connectd: remove per_peer_state in favor of keeping gossip_fd directly.
rustyrussell Jan 11, 2022
12a0a05
connectd: put more stuff into struct gossip_state.
rustyrussell Jan 11, 2022
a2a8893
connectd: get addresses from lightningd, not gossipd.
rustyrussell Jan 11, 2022
65db41b
various: minor cleanups from Christian's review.
rustyrussell Jan 11, 2022
eeff573
connectd: drop support (unused) for @ during handshake.
rustyrussell Jan 11, 2022
5bc92fc
connectd: implement @ correctly.
rustyrussell Jan 11, 2022
029fdcf
msg_queue: don't allow magic MSG_PASS_FD message for peers.
rustyrussell Jan 11, 2022
22a5676
ccan: update to get io_sock_shutdown
rustyrussell Jan 11, 2022
3df6eba
connectd: don't just close to peer, but use shutdown().
rustyrussell Jan 11, 2022
c35dde8
connectd: also do the shutdown()-close for final_msg sends.
rustyrussell Jan 11, 2022
2ff7746
connectd: flush queues before hanging up.
rustyrussell Jan 11, 2022
e8bd20f
patch dual-open-control-double-notify-fix.patch
rustyrussell Jan 11, 2022
9199de5
pytest: fix flake in test_reconnect_sender_add1
rustyrussell Jan 11, 2022
7e85667
peer subds: ignore failed writes.
rustyrussell Jan 11, 2022
3f532bf
pytest: disable tests/test_closing.py::test_onchain_all_dust
rustyrussell Jan 11, 2022
f096e8e
pytest: disable automatic reconnection.
rustyrussell Jan 11, 2022
f63b944
connectd: make sure we io_log msgs doing to gossipd.
rustyrussell Jan 11, 2022
49c8d95
connectd: don't ignore requests to connect if we're shutting down.
rustyrussell Jan 11, 2022
013d895
pytest: disable test_closing_different_fees for elements temporarily.
rustyrussell Jan 12, 2022
886bede
pytest: fix race when we mine blocks after pay().
rustyrussell Jan 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ccan/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CCAN imported from http://ccodearchive.net.

CCAN version: init-2523-gb15b3673
CCAN version: init-2524-g609670cc
12 changes: 12 additions & 0 deletions ccan/ccan/io/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,18 @@ bool io_plan_out_started(const struct io_conn *conn)
return conn->plan[IO_OUT].status == IO_POLLING_STARTED;
}

/* Despite being a TCP expert, I missed the full extent of this
* problem. The legendary ZmnSCPxj implemented it (with the URL
* pointing to the explanation), and I imitate that here. */
struct io_plan *io_sock_shutdown(struct io_conn *conn)
{
if (shutdown(io_conn_fd(conn), SHUT_WR) != 0)
return io_close(conn);

/* And leave unset .*/
return &conn->plan[IO_IN];
}

bool io_flush_sync(struct io_conn *conn)
{
struct io_plan *plan = &conn->plan[IO_OUT];
Expand Down
34 changes: 34 additions & 0 deletions ccan/ccan/io/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,40 @@ struct io_plan *io_out_always_(struct io_conn *conn,
void *),
void *arg);

/**
* io_sock_shutdown - start socket close process (flushes TCP sockets).
* @conn: the connection the plan is for
*
* Simply closing a TCP socket can lose data; unfortunately you should
* shutdown(SHUT_WR) and wait for the other side to see this and close.
* Of course, you also need to set a timer, in case it doesn't (you may
* already have some responsiveness timer, of course).
*
* On error, is equivalent to io_close().
*
* Example:
* #include <ccan/timer/timer.h>
*
* // Timer infra needs wrapper to contain extra data.
* struct timeout_timer {
* struct timer t;
* struct io_conn *conn;
* };
* static struct timers timers;
*
* static struct io_plan *flush_and_close(struct io_conn *conn)
* {
* struct timeout_timer *timeout;
* // Freed if conn closes normally.
* timeout = tal(conn, struct timeout_timer);
* timeout->conn = conn;
* timeout->t = conn;
* timer_addrel(&timers, &timeout->t, time_from_sec(5));
* return io_sock_shutdown(conn);
* }
*/
struct io_plan *io_sock_shutdown(struct io_conn *conn);

/**
* io_connect - create an asynchronous connection to a listening socket.
* @conn: the connection that plan is for.
Expand Down
8 changes: 3 additions & 5 deletions channeld/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,17 @@ CHANNELD_COMMON_OBJS := \
common/channel_config.o \
common/channel_id.o \
common/channel_type.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/ecdh_hsmd.o \
common/features.o \
common/fee_states.o \
common/status_wiregen.o \
common/peer_status_wiregen.o \
common/gossip_rcvd_filter.o \
common/peer_io.o \
common/peer_status_wiregen.o \
common/status_wiregen.o \
common/gossip_store.o \
common/hmac.o \
common/htlc_state.o \
Expand Down
Loading