From 5fb1f20898acdaa181408da9eec7013ab42bd8fb Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 23 May 2017 20:31:17 +0930 Subject: [PATCH] gossip: make connection own peer. We steal it when we're closing connection, but we normally want to forget it if connection just dies. Signed-off-by: Rusty Russell --- lightningd/gossip/gossip.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lightningd/gossip/gossip.c b/lightningd/gossip/gossip.c index c16ad81e5..c0c7fd378 100644 --- a/lightningd/gossip/gossip.c +++ b/lightningd/gossip/gossip.c @@ -379,6 +379,9 @@ static struct io_plan *new_peer_got_fd(struct io_conn *conn, struct peer *peer) if (!peer->conn) { peer->error = "Could not create connection"; tal_free(peer); + } else { + /* If conn dies, we forget peer. */ + tal_steal(peer->conn, peer); } return daemon_conn_read_next(conn,&peer->daemon->master); }