mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-02 20:54:23 +01:00
tools/gossipwith: shutdown, don't close, TCP socket.
This isn't the cause of the test_gossip_ratelimit flake I saw (since the final gossip msg clearly was received), but it's still good to fix since it means we might not send the final messages. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -246,6 +246,15 @@ static struct io_plan *handshake_success(struct io_conn *conn,
|
||||
--max_messages;
|
||||
}
|
||||
}
|
||||
|
||||
/* Simply closing the fd can lose writes; send shutdown and wait
|
||||
* for them to close (set alarm just in case!) */
|
||||
alarm(30);
|
||||
|
||||
if (shutdown(peer_fd, SHUT_WR) != 0)
|
||||
err(1, "failed to shutdown write to peer: %s", strerror(errno));
|
||||
|
||||
while (sync_crypto_read(NULL, peer_fd, cs));
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user