libp2p / js-libp2p

The JavaScript Implementation of libp2p networking stack.
https://libp2p.github.io/js-libp2p/
Apache License 2.0
2.34k stars 446 forks source link

feat!: ping peers before adding to routing table #2745

Closed achingbrain closed 1 month ago

achingbrain commented 1 month ago

Implements the check-before-add client optimisation to ping a peer before adding it to the routing table.

Adds a "new peer ping queue" to apply a concurrency limit to these pings, because it would be expected for old contacts to be less likely to be online so don't block adding new contacts to unrelated buckets if the connection to an old contact is timing out while being pinged before eviction.

BREAKING CHANGE: the routing ping options have been split into "old contact" and "new contact" and renamed according

Change checklist