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 <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell 2017-05-23 20:31:17 +09:30
parent aef745e37d
commit 5fb1f20898

View File

@ -379,6 +379,9 @@ static struct io_plan *new_peer_got_fd(struct io_conn *conn, struct peer *peer)
if (!peer->conn) { if (!peer->conn) {
peer->error = "Could not create connection"; peer->error = "Could not create connection";
tal_free(peer); tal_free(peer);
} else {
/* If conn dies, we forget peer. */
tal_steal(peer->conn, peer);
} }
return daemon_conn_read_next(conn,&peer->daemon->master); return daemon_conn_read_next(conn,&peer->daemon->master);
} }