Struct nakamoto_p2p::protocol::connmgr::ConnectionManager [−][src]
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]
&mut self,
_time: LocalTime,
addrs: &mut A
)
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]
&mut self,
address: SocketAddr,
local_address: SocketAddr,
link: Link,
time: LocalTime
)
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]
&mut self,
addr: &SocketAddr,
addrs: &A
)
Call when a peer disconnected.
pub fn received_timeout<S: Store, A: AddressSource>(
&mut self,
local_time: LocalTime,
addrs: &A
)
[src]
&mut self,
local_time: LocalTime,
addrs: &A
)
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]
U: RefUnwindSafe,
impl<U> Send for ConnectionManager<U> where
U: Send,
[src]
U: Send,
impl<U> Sync for ConnectionManager<U> where
U: Sync,
[src]
U: Sync,
impl<U> Unpin for ConnectionManager<U> where
U: Unpin,
[src]
U: Unpin,
impl<U> UnwindSafe for ConnectionManager<U> where
U: UnwindSafe,
[src]
U: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,