~ Destroy a peer, usually because the per-peer daemon has exited. * * Were you wondering why we call this "destroy_peer" and not "peer_destroy"? * I thought not! But while CCAN modules are required to keep to their own * prefix namespace, leading to unnatural word order, we couldn't stomach that * for our own internal use. We use 'find_foo', 'destroy_foo' and 'new_foo'. */
| 80 | * for our own internal use. We use 'find_foo', 'destroy_foo' and 'new_foo'. |
| 81 | */ |
| 82 | static void destroy_peer(struct peer *peer) |
| 83 | { |
| 84 | struct node *node; |
| 85 | |
| 86 | /* Remove it from the peers list */ |
| 87 | list_del_from(&peer->daemon->peers, &peer->list); |
| 88 | |
| 89 | /* If we have a channel with this peer, disable it. */ |
| 90 | node = get_node(peer->daemon->rstate, &peer->id); |
| 91 | if (node) |
| 92 | peer_disable_channels(peer->daemon, node); |
| 93 | } |
| 94 | |
| 95 | /* Search for a peer. */ |
| 96 | struct peer *find_peer(struct daemon *daemon, const struct node_id *id) |
nothing calls this directly
no test coverage detected