[][src]Struct networking::Peer

pub struct Peer { /* fields omitted */ }

A tower::Service representing an individual peer.

Relies on a backing NodeDataStore Service to obtain block and transaction information. If the NodeDataStore polls unready, this information will be propagated to the ConnectionManager struct, which may drop the the corresponding peer to relieve backpressure.

Implementations

impl Peer[src]

pub async fn at_address(
    id: usize,
    address: SocketAddr,
    config: Arc<Config>
) -> Result<Peer, PeerError>
[src]

pub async fn from_connection(
    id: usize,
    connection: TcpStream,
    config: Arc<Config>
) -> Peer
[src]

pub async fn send<'_>(&'_ mut self, msg: Message) -> Result<(), PeerError>[src]

pub fn get_ip_address(&self) -> SocketAddr[src]

pub fn get_daemon_address(&self) -> SocketAddr[src]

pub fn get_best_block(&self) -> u32[src]

pub async fn receive<'_>(
    &'_ mut self,
    _timeout_duration: Option<Duration>
) -> Result<Message, PeerError>
[src]

pub async fn receive_expected<'_>(
    &'_ mut self,
    expected: Command,
    timeout_duration: Option<Duration>
) -> Result<Message, PeerError>
[src]

pub async fn perform_handshake<'_>(
    &'_ mut self,
    best_block: Option<u32>
) -> Result<(), PeerError>
[src]

pub async fn accept_handshake<'_>(
    &'_ mut self,
    best_block: Option<u32>
) -> Result<(), PeerError>
[src]

pub fn create_version_msg(&self, best_block: Option<u32>) -> Message[src]

Trait Implementations

impl Debug for Peer[src]

Auto Trait Implementations

impl !RefUnwindSafe for Peer

impl Send for Peer

impl Sync for Peer

impl Unpin for Peer

impl !UnwindSafe for Peer

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> Instrument 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.