| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
LibP2P.Protocol.GossipSub.DirectConnect
Description
Keep configured GossipSub direct peers connected.
gossipsub-v1.1.md explicit peering: the router establishes a connection
to every configured direct peer and re-establishes it when it drops.
Addresses come from the Switch (certified record, else Identify listen
addresses). A peer with no stored addresses is skipped. Dialling goes
through dial, so backoff, deduplication, gating,
and the resource manager apply. This is not peer exchange: PX peers
are untrusted advertisements, direct peers are configured agreements.
Synopsis
- data DirectDialSlots
- newDirectDialSlots :: IO DirectDialSlots
- connectMissingDirectPeers :: Switch -> GossipSubRouter -> DirectDialSlots -> IO ()
- reconnectDirectPeer :: Switch -> GossipSubRouter -> DirectDialSlots -> PeerId -> IO ()
- runDirectConnectLoop :: Switch -> GossipSubRouter -> TVar Bool -> DirectDialSlots -> IO ()
- cancelDirectDials :: DirectDialSlots -> IO ()
Documentation
data DirectDialSlots Source #
In-flight direct dials. Nothing is a claim that a worker is about
to start, so a second wake cannot spawn another one.
connectMissingDirectPeers :: Switch -> GossipSubRouter -> DirectDialSlots -> IO () Source #
Dial every configured direct peer that is down and has stored addresses.
reconnectDirectPeer :: Switch -> GossipSubRouter -> DirectDialSlots -> PeerId -> IO () Source #
Dial one direct peer if it is configured, down, and addressable. A non-direct peer is ignored, so a PX disconnect cannot enter this path.
runDirectConnectLoop :: Switch -> GossipSubRouter -> TVar Bool -> DirectDialSlots -> IO () Source #
Initial pass, then one pass per paramDirectConnectInterval, until
started is false. An interval of 0 runs the initial pass only.
cancelDirectDials :: DirectDialSlots -> IO () Source #
Cancel workers claimed by a slot map. Idempotent.