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

Function peer_score

connectd/connectd.c:571–583  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

569
570/* How much is peer worth (when considering disconnect)? */
571static size_t peer_score(struct daemon *daemon,
572 const struct node_id *id,
573 struct subd **subds)
574{
575#define PEER_SCORE_MAX 2
576 /* Explicitly important! */
577 if (important_id_htable_get(daemon->important_ids, id))
578 return 2;
579 /* Otherwise, prefer ones which aren't talking. */
580 if (tal_count(subds))
581 return 1;
582 return 0;
583}
584
585/*~ When file descriptors are exhausted, we might be better to try to
586 * 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