MCPcopy Create free account
hub / github.com/ElementsProject/lightning / force_peer_disconnect

Function force_peer_disconnect

lightningd/connect_control.c:609–641  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607}
608
609void force_peer_disconnect(struct lightningd *ld,
610 const struct peer *peer,
611 const char *why)
612{
613 struct channel *c, *next;
614
615 /* Don't bother on shutting down */
616 if (!ld->connectd)
617 return;
618
619 /* Disconnect subds */
620 if (peer->uncommitted_channel)
621 kill_uncommitted_channel(peer->uncommitted_channel, why);
622
623 list_for_each_safe(&peer->channels, c, next, list) {
624 if (!c->owner)
625 continue;
626
627 if (!channel_state_wants_peercomms(c->state))
628 continue;
629
630 log_debug(c->log, "Forcing disconnect due to %s", why);
631 /* This frees c! */
632 if (channel_state_uncommitted(c->state))
633 channel_unsaved_close_conn(c, why);
634 else
635 channel_set_owner(c, NULL);
636 }
637
638 subd_send_msg(peer->ld->connectd,
639 take(towire_connectd_disconnect_peer(NULL, &peer->id,
640 peer->connectd_counter)));
641}
642
643static void connect_init_done(struct subd *connectd,
644 const u8 *reply,

Callers 6

peer_restart_dualopendFunction · 0.70
channel_errFunction · 0.70
graceful_disconnectFunction · 0.70
json_disconnectFunction · 0.70
peer_start_closingdFunction · 0.70
peer_start_channeldFunction · 0.70

Calls 7

channel_set_ownerFunction · 0.85
kill_uncommitted_channelFunction · 0.70
subd_send_msgFunction · 0.70

Tested by

no test coverage detected