mirror of
https://github.com/aljazceru/lightning.git
synced 2026-01-05 23:24:21 +01:00
lightningd: move notification of disconnect into when we hear from connectd.
Simpler, and closes a potential race. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -46,8 +46,6 @@ static void channel_disconnect(struct channel *channel,
|
||||
log_(channel->log, level, NULL, false, "%s", desc);
|
||||
channel_cleanup_commands(channel, desc);
|
||||
|
||||
notify_disconnect(channel->peer->ld, &channel->peer->id);
|
||||
|
||||
if (!reconnect)
|
||||
channel_set_owner(channel, NULL);
|
||||
else
|
||||
|
||||
@@ -110,7 +110,6 @@ void uncommitted_channel_disconnect(struct uncommitted_channel *uc,
|
||||
subd_send_msg(uc->peer->ld->connectd, msg);
|
||||
if (uc->fc && uc->fc->cmd)
|
||||
was_pending(command_fail(uc->fc->cmd, LIGHTNINGD, "%s", desc));
|
||||
notify_disconnect(uc->peer->ld, &uc->peer->id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -293,8 +293,6 @@ void channel_errmsg(struct channel *channel,
|
||||
bool warning,
|
||||
const u8 *err_for_them)
|
||||
{
|
||||
notify_disconnect(channel->peer->ld, &channel->peer->id);
|
||||
|
||||
/* Clean up any in-progress open attempts */
|
||||
channel_cleanup_commands(channel, desc);
|
||||
|
||||
@@ -1267,6 +1265,9 @@ void peer_disconnect_done(struct lightningd *ld, const u8 *msg)
|
||||
if (p)
|
||||
p->is_connected = false;
|
||||
|
||||
/* Fire off plugin notifications */
|
||||
notify_disconnect(ld, &id);
|
||||
|
||||
/* Wake any disconnect commands (removes self from list) */
|
||||
list_for_each_safe(&ld->disconnect_commands, i, next, list) {
|
||||
if (!node_id_eq(&i->id, &id))
|
||||
|
||||
Reference in New Issue
Block a user