connectd: Update connection list with new address

If we're already attempting to connect to a peer, we would ignore
new connection requests. This is problematic if your node has bad
connection details for the node -- you can't update it while inflight.

This patch appends new connection suggestions to the list of connections
to try.

Fixes #4154
This commit is contained in:
niftynei
2020-11-10 18:23:21 -06:00
committed by neil saitug
parent cd7d5cdff9
commit 4a3ee19a22
3 changed files with 67 additions and 1 deletions

View File

@@ -1457,8 +1457,17 @@ static void try_connect_peer(struct daemon *daemon,
return;
/* If we're trying to connect it right now, that's OK. */
if (find_connecting(daemon, id))
if ((connect = find_connecting(daemon, id))) {
/* If we've been passed in new connection details
* for this connection, update our addrhint + add
* to addresses to check */
if (addrhint) {
connect->addrhint = tal_steal(connect, addrhint);
tal_arr_expand(&connect->addrs, *addrhint);
}
return;
}
/* Start an array of addresses to try. */
addrs = tal_arr(tmpctx, struct wireaddr_internal, 0);