connectd: remove reconnection logic.

We don't have to put aside a peer which is reconnecting and wait for
lightningd to remove the old peer, we can now simply free the old
and add the new.

Fixes: #5240
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2022-07-16 14:19:30 +09:30
committed by neil saitug
parent 7b0c11efb4
commit 9b6c97437e
5 changed files with 6 additions and 114 deletions

View File

@@ -386,21 +386,6 @@ static void peer_already_connected(struct lightningd *ld, const u8 *msg)
&peer->addr);
}
static void peer_please_disconnect(struct lightningd *ld, const u8 *msg)
{
struct node_id id;
struct peer *peer;
if (!fromwire_connectd_reconnected(msg, &id))
fatal("Bad msg %s from connectd", tal_hex(tmpctx, msg));
peer = peer_by_id(ld, &id);
if (!peer)
return;
peer_channels_cleanup_on_disconnect(peer);
}
struct custommsg_payload {
struct node_id peer_id;
u8 *msg;
@@ -482,10 +467,6 @@ static unsigned connectd_msg(struct subd *connectd, const u8 *msg, const int *fd
case WIRE_CONNECTD_PING_REPLY:
break;
case WIRE_CONNECTD_RECONNECTED:
peer_please_disconnect(connectd->ld, msg);
break;
case WIRE_CONNECTD_PEER_CONNECTED:
peer_connected(connectd->ld, msg);
break;