hs-libp2p-0.2.0.0: Haskell implementation of the libp2p networking stack
Safe HaskellNone
LanguageGHC2021

LibP2P.Protocol.GossipSub.PeerExchange

Description

Dial peers advertised by an accepted GossipSub peer exchange.

handlePrune already applies stAcceptPXThreshold and drops envelopes that do not open (gossipsub-v1.1.md Peer Exchange; RFC 0003). The callback installed by newGossipSubNode does the rest: keep a fresher certified record, then dial so the pruned node can reform its mesh.

Self, duplicate entries, already-connected peers, and peers in gossipsub or dial backoff are not dialed. At most pxMaxInFlight dials run at once (go-libp2p's connector count); further peers are skipped until a slot frees. dial enforces the resource manager, so this path does not open a connection around it.

Synopsis

Documentation

pxMaxInFlight :: Int Source #

Concurrent PX dials. go-libp2p's GossipSubConnectors default.

installPeerExchange :: Switch -> GossipSubRouter -> IO () Source #

Replace the router's no-op PX callback with the production dialer.

dialAcceptedPX :: Switch -> GossipSubRouter -> TVar Int -> Topic -> [PeerExchangeInfo] -> IO () Source #

Act on PX entries the router has already accepted.