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

Function force_peer_disconnect

lightningd/connect_control.c:664–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

662}
663
664void force_peer_disconnect(struct lightningd *ld,
665 const struct peer *peer,
666 const char *why)
667{
668 struct channel *c, *next;
669
670 /* Don't bother on shutting down */
671 if (!ld->connectd)
672 return;
673
674 /* Disconnect subds */
675 if (peer->uncommitted_channel)
676 kill_uncommitted_channel(peer->uncommitted_channel, why);
677
678 list_for_each_safe(&peer->channels, c, next, list) {
679 if (!c->owner)
680 continue;
681
682 if (!channel_state_wants_peercomms(c->state))
683 continue;
684
685 log_debug(c->log, "Forcing disconnect due to %s", why);
686 /* This frees c! */
687 if (channel_state_uncommitted(c->state))
688 channel_unsaved_close_conn(c, why);
689 else
690 channel_set_owner(c, NULL);
691 }
692
693 subd_send_msg(peer->ld->connectd,
694 take(towire_connectd_disconnect_peer(NULL, &peer->id,
695 peer->connectd_counter)));
696}
697
698static void connect_init_done(struct subd *connectd,
699 const u8 *reply,

Callers 7

peer_restart_dualopendFunction · 0.70
channel_errFunction · 0.70
graceful_disconnectFunction · 0.70
json_disconnectFunction · 0.70
peer_start_closingdFunction · 0.70
opening_fundee_finishedFunction · 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