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: PendingInboundConnectionError<TTrans::Error>, handler: THandler, }, ConnectionEstablished { connection: EstablishedConnection<'a, TInEvent>, other_established_connection_ids: Vec<ConnectionId>, concurrent_dial_errors: Option<Vec<(Multiaddr, TransportError<TTrans::Error>)>>, }, ConnectionClosed { id: ConnectionId, connected: Connected, error: Option<ConnectionError<<THandler::Handler as ConnectionHandler>::Error>>, remaining_established_connection_ids: Vec<ConnectionId>, handler: THandler::Handler, }, DialError { handler: THandler, peer_id: PeerId, error: PendingOutboundConnectionError<TTrans::Error>, }, UnknownPeerDialError { error: PendingOutboundConnectionError<TTrans::Error>, handler: THandler, }, ConnectionEvent { connection: EstablishedConnection<'a, TInEvent>, event: TOutEvent, }, AddressChange { connection: EstablishedConnection<'a, TInEvent>, new_endpoint: ConnectedPoint, old_endpoint: ConnectedPoint, }, }
Expand description

Event that can happen on the Network.

Variants

ListenerClosed

Fields

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.

One of the listeners gracefully closed.

ListenerError

Fields

listener_id: ListenerId

The listener that errored.

error: TTrans::Error

The listener error.

One of the listeners reported a non-fatal error.

NewListenerAddress

Fields

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.

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

ExpiredListenerAddress

Fields

listener_id: ListenerId

The listener that is no longer listening on some address.

listen_addr: Multiaddr

The expired address.

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

IncomingConnection

Fields

listener_id: ListenerId

The listener who received the connection.

connection: IncomingConnection<TTrans::ListenerUpgrade>

The pending incoming connection.

A new connection arrived on a listener.

To accept the connection, see Network::accept.

IncomingConnectionError

Fields

local_addr: Multiaddr

Local connection address.

send_back_addr: Multiaddr

Address used to send back data to the remote.

error: PendingInboundConnectionError<TTrans::Error>

The error that happened.

handler: THandler

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.

ConnectionEstablished

Fields

connection: EstablishedConnection<'a, TInEvent>

The newly established connection.

other_established_connection_ids: Vec<ConnectionId>

List of other connections to the same peer.

Note: Does not include the connection reported through this event.

concurrent_dial_errors: Option<Vec<(Multiaddr, TransportError<TTrans::Error>)>>

Some when the new connection is an outgoing connection. Addresses are dialed in parallel. Contains the addresses and errors of dial attempts that failed before the one successful dial.

A new connection to a peer has been established.

ConnectionClosed

Fields

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.

remaining_established_connection_ids: Vec<ConnectionId>

List of remaining established connections to the same peer.

handler: THandler::Handler

An established connection to a peer has been closed.

A connection may close if

DialError

Fields

handler: THandler

The number of remaining dialing attempts.

peer_id: PeerId

Id of the peer we were trying to dial.

error: PendingOutboundConnectionError<TTrans::Error>

The error that happened.

A dialing attempt to an address of a peer failed.

UnknownPeerDialError

Fields

error: PendingOutboundConnectionError<TTrans::Error>

The error that happened.

handler: THandler

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

ConnectionEvent

Fields

connection: EstablishedConnection<'a, TInEvent>

The connection on which the event occurred.

event: TOutEvent

Event that was produced by the node.

An established connection produced an event.

AddressChange

Fields

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.

An established connection has changed its address.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.