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: PendingInboundConnectionError<TTrans::Error>,
handler: THandler,
},
ConnectionEstablished {
connection: EstablishedConnection<'a, TInEvent>,
num_established: NonZeroU32,
concurrent_dial_errors: Option<Vec<(Multiaddr, TransportError<TTrans::Error>)>>,
},
ConnectionClosed {
id: ConnectionId,
connected: Connected,
error: Option<ConnectionError<<THandler::Handler as ConnectionHandler>::Error>>,
num_established: u32,
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
One of the listeners gracefully closed.
Fields of ListenerClosed
One of the listeners reported a non-fatal error.
Fields of ListenerError
One of the listeners is now listening on an additional address.
Fields of NewListenerAddress
listener_id: ListenerIdThe listener that is listening on the new address.
listen_addr: MultiaddrThe new address the listener is now also listening on.
One of the listeners is no longer listening on some address.
Fields of ExpiredListenerAddress
listener_id: ListenerIdThe listener that is no longer listening on some address.
listen_addr: MultiaddrThe expired address.
A new connection arrived on a listener.
To accept the connection, see Network::accept.
Fields of IncomingConnection
listener_id: ListenerIdThe listener who received the connection.
connection: IncomingConnection<TTrans::ListenerUpgrade>The pending incoming connection.
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: MultiaddrLocal connection address.
send_back_addr: MultiaddrAddress used to send back data to the remote.
error: PendingInboundConnectionError<TTrans::Error>The error that happened.
handler: THandlerA new connection to a peer has been established.
Fields of ConnectionEstablished
connection: EstablishedConnection<'a, TInEvent>The newly established connection.
num_established: NonZeroU32The total number of established connections to the same peer, including the one that has just been opened.
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.
An established connection to a peer has been closed.
A connection may close if
- it encounters an error, which includes the connection being
closed by the remote. In this case
errorisSome. - it was actively closed by
EstablishedConnection::start_close, i.e. a successful, orderly close. In this caseerrorisNone. - it was actively closed by
super::peer::ConnectedPeer::disconnectorsuper::peer::DialingPeer::disconnect, i.e. dropped without an orderly close. In this caseerrorisNone.
Fields of ConnectionClosed
id: ConnectionIdThe ID of the connection that encountered an error.
connected: ConnectedInformation about the connection that encountered the error.
error: Option<ConnectionError<<THandler::Handler as ConnectionHandler>::Error>>The error that occurred.
num_established: u32The remaining number of established connections to the same peer.
handler: THandler::HandlerA dialing attempt to an address of a peer failed.
Fields of DialError
handler: THandlerThe number of remaining dialing attempts.
peer_id: PeerIdId of the peer we were trying to dial.
error: PendingOutboundConnectionError<TTrans::Error>The error that happened.
Failed to reach a peer that we were trying to dial.
Fields of UnknownPeerDialError
An established connection produced an event.
Fields of ConnectionEvent
connection: EstablishedConnection<'a, TInEvent>The connection on which the event occurred.
event: TOutEventEvent that was produced by the node.
An established connection has changed its address.
Fields of AddressChange
connection: EstablishedConnection<'a, TInEvent>The connection whose address has changed.
new_endpoint: ConnectedPointNew endpoint of this connection.
old_endpoint: ConnectedPointOld endpoint of this connection.