pub struct ConnectedPeers { /* private fields */ }
Expand description
ConnectedPeers manages the set of connected peers based on discovery, new connection, and peer session lifetime.
Implementations§
Source§impl ConnectedPeers
impl ConnectedPeers
pub fn new( streams_builder: StreamsBuilder, permits: Permits, profile: ProfileProxy, metrics: MetricsLogger, ) -> Self
pub fn is_connected(&self, id: &PeerId) -> bool
pub fn found( &self, id: PeerId, desc: ProfileDescriptor, preferred_directions: HashSet<EndpointType>, )
pub fn set_preferred_peer_direction(&self, direction: EndpointType)
pub fn preferred_peer_direction(&self) -> EndpointType
pub fn try_connect( &self, id: PeerId, channel_params: ChannelParameters, ) -> impl Future<Output = Result<Option<Channel>, Error>>
Sourcepub async fn connected(
&self,
id: PeerId,
channel: Channel,
initiator_delay: Option<MonotonicDuration>,
) -> Result<DetachableWeak<PeerId, Peer>, Error>
pub async fn connected( &self, id: PeerId, channel: Channel, initiator_delay: Option<MonotonicDuration>, ) -> Result<DetachableWeak<PeerId, Peer>, Error>
Accept a channel that is connected to the peer id
.
If initiator_delay
is set, attempt to start a stream after the specified delay.
initiator_delay
has no effect if the peer already has a control channel.
Returns a weak peer pointer (even if it was previously connected) if successful.
Sourcepub fn connected_stream(&self) -> PeerConnections
pub fn connected_stream(&self) -> PeerConnections
Get a stream that produces peers that have been connected.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ConnectedPeers
impl !RefUnwindSafe for ConnectedPeers
impl Send for ConnectedPeers
impl Sync for ConnectedPeers
impl Unpin for ConnectedPeers
impl !UnwindSafe for ConnectedPeers
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more