Struct network::peer_manager::PeerManager
source · pub struct PeerManager<TTransport, TSocket>where
TTransport: Transport,
TSocket: AsyncRead + AsyncWrite,{ /* private fields */ }
Expand description
Responsible for handling and maintaining connections to other Peers
Implementations§
source§impl<TTransport, TSocket> PeerManager<TTransport, TSocket>where
TTransport: Transport<Output = Connection<TSocket>> + Send + 'static,
TSocket: TransportTSocket,
impl<TTransport, TSocket> PeerManager<TTransport, TSocket>where TTransport: Transport<Output = Connection<TSocket>> + Send + 'static, TSocket: TransportTSocket,
sourcepub fn new(
executor: Handle,
time_service: TimeService,
transport: TTransport,
network_context: Arc<NetworkContext>,
listen_addr: NetworkAddress,
peer_metadata_storage: Arc<PeerMetadataStorage>,
trusted_peers: Arc<RwLock<PeerSet>>,
requests_rx: Receiver<(PeerId, ProtocolId), PeerManagerRequest>,
connection_reqs_rx: Receiver<PeerId, ConnectionRequest>,
upstream_handlers: HashMap<ProtocolId, Sender<(PeerId, ProtocolId), PeerManagerNotification>>,
connection_event_handlers: Vec<Sender>,
channel_size: usize,
max_concurrent_network_reqs: usize,
max_frame_size: usize,
inbound_connection_limit: usize,
inbound_rate_limiters: IpAddrTokenBucketLimiter,
outbound_rate_limiters: IpAddrTokenBucketLimiter
) -> Self
pub fn new( executor: Handle, time_service: TimeService, transport: TTransport, network_context: Arc<NetworkContext>, listen_addr: NetworkAddress, peer_metadata_storage: Arc<PeerMetadataStorage>, trusted_peers: Arc<RwLock<PeerSet>>, requests_rx: Receiver<(PeerId, ProtocolId), PeerManagerRequest>, connection_reqs_rx: Receiver<PeerId, ConnectionRequest>, upstream_handlers: HashMap<ProtocolId, Sender<(PeerId, ProtocolId), PeerManagerNotification>>, connection_event_handlers: Vec<Sender>, channel_size: usize, max_concurrent_network_reqs: usize, max_frame_size: usize, inbound_connection_limit: usize, inbound_rate_limiters: IpAddrTokenBucketLimiter, outbound_rate_limiters: IpAddrTokenBucketLimiter ) -> Self
Construct a new PeerManager actor
pub fn update_connected_peers_metrics(&self)
sourcepub fn listen_addr(&self) -> &NetworkAddress
pub fn listen_addr(&self) -> &NetworkAddress
Get the [NetworkAddress
] we’re listening for incoming connections on