connectd: generate message for lightningd inside peer_connected().

We used to generate this in the caller, then save it in case we needed
to retry.  We're about to change the message we send to lightningd, so
we'll need to regenerate it every time; just hand all the extra args
into peer_connected() and we can generate the `connect_peer_connected`
msg there.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

1diff --git a/connectd/connectd.c b/connectd/connectd.c
index 94fe50b56..459c9ac63 100644
This commit is contained in:
Rusty Russell
2019-06-04 03:44:25 +09:30
parent 4399faf57c
commit a40f45af55
3 changed files with 35 additions and 21 deletions

View File

@@ -80,15 +80,12 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
return io_write(conn, msg, tal_count(msg), io_close_cb, NULL);
}
/* Create message to tell master peer has connected. */
msg = towire_connect_peer_connected(NULL, &peer->id, &peer->addr,
&peer->cs,
globalfeatures, localfeatures);
/* Usually return io_close_taken_fd, but may wait for old peer to
* be disconnected if it's a reconnect. */
return peer_connected(conn, peer->daemon, &peer->id,
take(msg), take(localfeatures));
&peer->addr, &peer->cs,
take(globalfeatures),
take(localfeatures));
}
static struct io_plan *peer_init_hdr_received(struct io_conn *conn,