mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 01:43:36 +01:00
lightningd: clean up peer connection handling a little.
Update the address and direction as soon as it connects not just when we're about to make it active: we want this even if we don't have an active channel, or if the connect hook rejects it. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
8458994a7f
commit
1e4149f18a
@ -1018,9 +1018,6 @@ static void peer_connected_hook_final(struct peer_connected_hook_payload *payloa
|
||||
channel_state_name(channel));
|
||||
|
||||
assert(!channel->owner);
|
||||
channel->peer->addr = addr;
|
||||
channel->peer->connected_incoming = payload->incoming;
|
||||
|
||||
subd_send_msg(ld->connectd,
|
||||
take(towire_connectd_peer_make_active(NULL, &peer->id,
|
||||
&channel->cid)));
|
||||
@ -1179,12 +1176,14 @@ void peer_connected(struct lightningd *ld, const u8 *msg)
|
||||
peer = new_peer(ld, 0, &id, &hook_payload->addr,
|
||||
hook_payload->incoming);
|
||||
peer->is_connected = true;
|
||||
/* Update peer address and direction */
|
||||
peer->addr = hook_payload->addr;
|
||||
peer->connected_incoming = hook_payload->incoming;
|
||||
peer_update_features(peer, their_features);
|
||||
|
||||
tal_steal(peer, hook_payload);
|
||||
hook_payload->peer = peer;
|
||||
|
||||
peer_update_features(peer, their_features);
|
||||
|
||||
/* Complete any outstanding connect commands. */
|
||||
connect_succeeded(ld, peer, hook_payload->incoming, &hook_payload->addr);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user