Module zebra_network::peer_set::initialize
source ยท Expand description
A peer set whose size is dynamically determined by resource constraints.
The PeerSet
implementation is adapted from the one in tower::Balance.
Modulesยง
- recent_
by_ ๐ip A set of IPs from recent connection attempts.
Enumsยง
- Crawler
Action ๐An action that the peer crawler can take.
Functionsยง
- Listens for peer connections on
addr
, then sets up each connection as a Zcash peer. - Set up a new inbound connection as a Zcash peer.
- add_
initial_ ๐peers Use the providedoutbound_connector
to connect to the configured DNS seeder and disk cache initial peers, then send the resulting peer connections overpeerset_tx
. - crawl ๐Try to get more peers using
candidates
, then queue a connection attempt usingdemand_tx
. If there were no new peers andshould_always_dial
is false, the connection attempt is skipped. - crawl_
and_ ๐dial Given a channeldemand_rx
that signals a need for new peers, try to find and connect to new peers, and send the resultingpeer::Client
s through thepeerset_tx
channel. - dial ๐Try to connect to
candidate
usingoutbound_connector
. Usesoutbound_connection_tracker
to track the active connection count. - Initialize a peer set, using a network
config
,inbound_service
, andlatest_chain_tip
. - limit_
initial_ ๐peers Limit the number ofinitial_peers
addresses entries to the configuredpeerset_initial_target_size
. - open_
listener ๐Open a peer connection listener onconfig.listen_addr
, returning the opened [TcpListener
], and the address it is bound to. - report_
failed ๐Markaddr
as a failed peer toaddress_book_updater
.
Type Aliasesยง
- Discovered
Peer ๐A successful outbound peer connection attempt or inbound connection handshake.