Enum libp2p_core::network::NetworkEvent[][src]

pub enum NetworkEvent<'a, TTrans, TInEvent, TOutEvent, THandler> where
    TTrans: Transport,
    THandler: IntoConnectionHandler
{ ListenerClosed { listener_id: ListenerId, addresses: Vec<Multiaddr>, reason: Result<(), TTrans::Error>, }, ListenerError { listener_id: ListenerId, error: TTrans::Error, }, NewListenerAddress { listener_id: ListenerId, listen_addr: Multiaddr, }, ExpiredListenerAddress { listener_id: ListenerId, listen_addr: Multiaddr, }, IncomingConnection { listener_id: ListenerId, connection: IncomingConnection<TTrans::ListenerUpgrade>, }, IncomingConnectionError { local_addr: Multiaddr, send_back_addr: Multiaddr, error: PendingConnectionError<TTrans::Error>, }, ConnectionEstablished { connection: EstablishedConnection<'a, TInEvent>, num_established: NonZeroU32, }, ConnectionClosed { id: ConnectionId, connected: Connected, error: Option<ConnectionError<<THandler::Handler as ConnectionHandler>::Error>>, num_established: u32, }, DialError { attempts_remaining: u32, peer_id: PeerId, multiaddr: Multiaddr, error: PendingConnectionError<TTrans::Error>, }, UnknownPeerDialError { multiaddr: Multiaddr, error: PendingConnectionError<TTrans::Error>, }, ConnectionEvent { connection: EstablishedConnection<'a, TInEvent>, event: TOutEvent, }, AddressChange { connection: EstablishedConnection<'a, TInEvent>, new_endpoint: ConnectedPoint, old_endpoint: ConnectedPoint, }, }

Event that can happen on the Network.

Variants

ListenerClosed

One of the listeners gracefully closed.

Fields of ListenerClosed

listener_id: ListenerId

The listener ID that closed.

addresses: Vec<Multiaddr>

The addresses that the listener was listening on.

reason: Result<(), TTrans::Error>

Reason for the closure. Contains Ok(()) if the stream produced None, or Err if the stream produced an error.

ListenerError

One of the listeners reported a non-fatal error.

Fields of ListenerError

listener_id: ListenerId

The listener that errored.

error: TTrans::Error

The listener error.

NewListenerAddress

One of the listeners is now listening on an additional address.

Fields of NewListenerAddress

listener_id: ListenerId

The listener that is listening on the new address.

listen_addr: Multiaddr

The new address the listener is now also listening on.

ExpiredListenerAddress

One of the listeners is no longer listening on some address.

Fields of ExpiredListenerAddress

listener_id: ListenerId

The listener that is no longer listening on some address.

listen_addr: Multiaddr

The expired address.

IncomingConnection

A new connection arrived on a listener.

To accept the connection, see Network::accept.

Fields of IncomingConnection

listener_id: ListenerId

The listener who received the connection.

connection: IncomingConnection<TTrans::ListenerUpgrade>

The pending incoming connection.

IncomingConnectionError

An error happened on a connection during its initial handshake.

This can include, for example, an error during the handshake of the encryption layer, or the connection unexpectedly closed.

Fields of IncomingConnectionError

local_addr: Multiaddr

Local connection address.

send_back_addr: Multiaddr

Address used to send back data to the remote.

error: PendingConnectionError<TTrans::Error>

The error that happened.

ConnectionEstablished

A new connection to a peer has been established.

Fields of ConnectionEstablished

connection: EstablishedConnection<'a, TInEvent>

The newly established connection.

num_established: NonZeroU32

The total number of established connections to the same peer, including the one that has just been opened.

ConnectionClosed

An established connection to a peer has been closed.

A connection may close if

Fields of ConnectionClosed

id: ConnectionId

The ID of the connection that encountered an error.

connected: Connected

Information about the connection that encountered the error.

error: Option<ConnectionError<<THandler::Handler as ConnectionHandler>::Error>>

The error that occurred.

num_established: u32

The remaining number of established connections to the same peer.

DialError

A dialing attempt to an address of a peer failed.

Fields of DialError

attempts_remaining: u32

The number of remaining dialing attempts.

peer_id: PeerId

Id of the peer we were trying to dial.

multiaddr: Multiaddr

The multiaddr we failed to reach.

error: PendingConnectionError<TTrans::Error>

The error that happened.

UnknownPeerDialError

Failed to reach a peer that we were trying to dial.

Fields of UnknownPeerDialError

multiaddr: Multiaddr

The multiaddr we failed to reach.

error: PendingConnectionError<TTrans::Error>

The error that happened.

ConnectionEvent

An established connection produced an event.

Fields of ConnectionEvent

connection: EstablishedConnection<'a, TInEvent>

The connection on which the event occurred.

event: TOutEvent

Event that was produced by the node.

AddressChange

An established connection has changed its address.

Fields of AddressChange

connection: EstablishedConnection<'a, TInEvent>

The connection whose address has changed.

new_endpoint: ConnectedPoint

New endpoint of this connection.

old_endpoint: ConnectedPoint

Old endpoint of this connection.

Trait Implementations

impl<TTrans, TInEvent, TOutEvent, THandler> Debug for NetworkEvent<'_, TTrans, TInEvent, TOutEvent, THandler> where
    TInEvent: Debug,
    TOutEvent: Debug,
    TTrans: Transport,
    TTrans::Error: Debug,
    THandler: IntoConnectionHandler,
    <THandler::Handler as ConnectionHandler>::Error: Debug
[src]

Auto Trait Implementations

impl<'a, TTrans, TInEvent, TOutEvent, THandler> !RefUnwindSafe for NetworkEvent<'a, TTrans, TInEvent, TOutEvent, THandler>[src]

impl<'a, TTrans, TInEvent, TOutEvent, THandler> Send for NetworkEvent<'a, TTrans, TInEvent, TOutEvent, THandler> where
    TInEvent: Send,
    TOutEvent: Send,
    <TTrans as Transport>::Error: Send,
    <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::Error: Send,
    <TTrans as Transport>::ListenerUpgrade: Send
[src]

impl<'a, TTrans, TInEvent, TOutEvent, THandler> Sync for NetworkEvent<'a, TTrans, TInEvent, TOutEvent, THandler> where
    TInEvent: Send,
    TOutEvent: Sync,
    <TTrans as Transport>::Error: Sync,
    <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::Error: Sync,
    <TTrans as Transport>::ListenerUpgrade: Sync
[src]

impl<'a, TTrans, TInEvent, TOutEvent, THandler> Unpin for NetworkEvent<'a, TTrans, TInEvent, TOutEvent, THandler> where
    TOutEvent: Unpin,
    <TTrans as Transport>::Error: Unpin,
    <<THandler as IntoConnectionHandler>::Handler as ConnectionHandler>::Error: Unpin,
    <TTrans as Transport>::ListenerUpgrade: Unpin
[src]

impl<'a, TTrans, TInEvent, TOutEvent, THandler> !UnwindSafe for NetworkEvent<'a, TTrans, TInEvent, TOutEvent, THandler>[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> Same<T> for T

type Output = T

Should always be Self

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,