Struct nakamoto_p2p::protocol::connmgr::ConnectionManager[][src]

pub struct ConnectionManager<U> {
    pub config: Config,
    // some fields omitted
}

Manages peer connections.

Fields

config: Config

Configuration.

Implementations

impl<U: Connect + Disconnect + Events + SetTimeout> ConnectionManager<U>[src]

pub fn new(upstream: U, config: Config) -> Self[src]

Create a new connection manager.

pub fn initialize<S: Store, A: AddressSource>(
    &mut self,
    _time: LocalTime,
    addrs: &mut A
)
[src]

Initialize the connection manager. Must be called once.

pub fn connect<S: Store, A: AddressSource>(&mut self, addr: &PeerId) -> bool[src]

Connect to a peer.

pub fn disconnect(&mut self, addr: PeerId, reason: DisconnectReason)[src]

Disconnect from a peer.

pub fn peer_connected(
    &mut self,
    address: SocketAddr,
    local_address: SocketAddr,
    link: Link,
    time: LocalTime
)
[src]

Call when a peer connected.

pub fn peer_negotiated(&mut self, address: SocketAddr, services: ServiceFlags)[src]

Call when a peer negotiated.

pub fn peer_disconnected<S: Store, A: AddressSource>(
    &mut self,
    addr: &SocketAddr,
    addrs: &A
)
[src]

Call when a peer disconnected.

pub fn received_timeout<S: Store, A: AddressSource>(
    &mut self,
    local_time: LocalTime,
    addrs: &A
)
[src]

Call when we recevied a timeout.

pub fn outbound_peers(&self) -> impl Iterator<Item = &PeerId>[src]

Returns outbound peer addresses.

pub fn inbound_peers(&self) -> impl Iterator<Item = &PeerId>[src]

Returns inbound peer addresses.

Trait Implementations

impl<U: Debug> Debug for ConnectionManager<U>[src]

Auto Trait Implementations

impl<U> RefUnwindSafe for ConnectionManager<U> where
    U: RefUnwindSafe
[src]

impl<U> Send for ConnectionManager<U> where
    U: Send
[src]

impl<U> Sync for ConnectionManager<U> where
    U: Sync
[src]

impl<U> Unpin for ConnectionManager<U> where
    U: Unpin
[src]

impl<U> UnwindSafe for ConnectionManager<U> where
    U: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.