lightningd: tell connectd to disconnect even if it's connecting now.

We were seeing hangs in disconnect in
tests/test_connection.py::test_feerate_stress, and looking at the logs
it's because we're not actually telling connectd to disconnect.

These days, we have a connect counter, so connectd knows to ignore it
if we simply haven't read the message about it already disconnecting.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2023-06-19 12:14:44 +09:30
parent 0c3757f3a8
commit 7820dfdb35

View File

@@ -2318,11 +2318,9 @@ static struct command_result *json_disconnect(struct command *cmd,
channel_state_name(channel));
}
/* If it's not already disconnecting, tell connectd to disconnect */
if (peer->connected == PEER_CONNECTED)
subd_send_msg(peer->ld->connectd,
take(towire_connectd_discard_peer(NULL, &peer->id,
peer->connectd_counter)));
subd_send_msg(peer->ld->connectd,
take(towire_connectd_discard_peer(NULL, &peer->id,
peer->connectd_counter)));
/* Connectd tells us when it's finally disconnected */
dc = tal(cmd, struct disconnect_command);