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

Function peer_score

connectd/connectd.c:606–618  ·  view source on GitHub ↗

How much is peer worth (when considering disconnect)? */

Source from the content-addressed store, hash-verified

604
605/* How much is peer worth (when considering disconnect)? */
606static size_t peer_score(struct daemon *daemon,
607 const struct node_id *id,
608 struct subd **subds)
609{
610#define PEER_SCORE_MAX 2
611 /* Explicitly important! */
612 if (important_id_htable_get(daemon->important_ids, id))
613 return 2;
614 /* Otherwise, prefer ones which aren't talking. */
615 if (tal_count(subds))
616 return 1;
617 return 0;
618}
619
620/*~ When file descriptors are exhausted, we might be better to try to
621 * free an existing connection, rather than ignoring new ones. */

Callers 1

close_random_connectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected