From 2ab5603624921dc9e6ea9949454e3c3d5afa5ec6 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 11 Jan 2022 11:47:30 +1030 Subject: [PATCH] peer subds: ignore failed writes. In the case where the peer sends an error (and hangs up) immediately after init, connectd *doesn't actually read the error* (even after all the previous fixes so it actually receives the error!). This is because to tried to first write WIRE_CHANNEL_REESTABLISH, and that fails, so it never tries to read. Generally, we should ignore write failures; we'll find out if the socket is closed when we read nothing. Signed-off-by: Rusty Russell --- common/peer_io.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/peer_io.c b/common/peer_io.c index 41c6caa97..3f090a834 100644 --- a/common/peer_io.c +++ b/common/peer_io.c @@ -18,8 +18,9 @@ void peer_write(struct per_peer_state *pps, const void *msg TAKES) { status_peer_io(LOG_IO_OUT, NULL, msg); - if (!wire_sync_write(pps->peer_fd, msg)) - peer_failed_connection_lost(); + /* We ignore write errors; we might still have something to read, + * so we'd rather fail there. */ + wire_sync_write(pps->peer_fd, msg); } u8 *peer_read(const tal_t *ctx, struct per_peer_state *pps)