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

Function peer_discard

connectd/connectd.c:1816–1835  ·  view source on GitHub ↗

lightningd tells us a peer should be disconnected. */

Source from the content-addressed store, hash-verified

1814
1815/* lightningd tells us a peer should be disconnected. */
1816static void peer_discard(struct daemon *daemon, const u8 *msg)
1817{
1818 struct node_id id;
1819 u64 counter;
1820 struct peer *peer;
1821
1822 if (!fromwire_connectd_discard_peer(msg, &id, &counter))
1823 master_badmsg(WIRE_CONNECTD_DISCARD_PEER, msg);
1824
1825 /* We should stay in sync with lightningd, but this can happen
1826 * under stress. */
1827 peer = peer_htable_get(&daemon->peers, &id);
1828 if (!peer)
1829 return;
1830 /* If it's reconnected already, it will learn soon. */
1831 if (peer->counter != counter)
1832 return;
1833 status_peer_debug(&id, "discard_peer");
1834 tal_free(peer);
1835}
1836
1837/* lightningd tells us to send a msg and disconnect. */
1838static void peer_final_msg(struct io_conn *conn,

Callers 1

recv_reqFunction · 0.85

Calls 2

tal_freeFunction · 0.85
master_badmsgFunction · 0.50

Tested by

no test coverage detected