[][src]Enum libp2prs_swarm::SwarmEvent

pub enum SwarmEvent {
    ConnectionEstablished {
        stream_muxer: IStreamMuxer,
        direction: Direction,
        tid: Option<usize>,
    },
    ConnectionClosed {
        cid: ConnectionId,
        error: TransportError,
    },
    StreamError {
        cid: ConnectionId,
        error: TransportError,
    },
    StreamOpened {
        view: SubstreamView,
    },
    IncomingConnectionError {
        remote_addr: Multiaddr,
        error: TransportError,
    },
    OutgoingConnectionError {
        peer_id: PeerId,
        error: SwarmError,
        tid: usize,
    },
    ListenAddressAdded(Multiaddr),
    ListenAddressDeleted(Multiaddr),
    ListenerClosed {
        addresses: Vec<Multiaddr>,
        reason: TransportError,
    },
    PingResult {
        cid: ConnectionId,
        result: Result<Duration, SwarmError>,
    },
    IdentifyResult {
        cid: ConnectionId,
        result: Result<(IdentifyInfo, Multiaddr), SwarmError>,
    },
}

Event generated by the Swarm.

Variants

ConnectionEstablished

A connection to the given peer has been opened.

Fields of ConnectionEstablished

stream_muxer: IStreamMuxer

The connection, AKA. the trait object of stream muxer.

direction: Direction

Direction of the connection.

tid: Option<usize>

The dial transaction id

ConnectionClosed

A connection with the given peer has been closed.

Fields of ConnectionClosed

cid: ConnectionId

The connection Id of the sub stream.

error: TransportError

The cause of the error.

StreamError

A stream failed to negotiate protocol with peer.

Fields of StreamError

cid: ConnectionId

The connection Id of the sub stream.

error: TransportError

The cause of the error.

StreamOpened

A new substream opened.

Fields of StreamOpened

view: SubstreamView

The view of the opened substream.

IncomingConnectionError

An error happened on accepting incoming connection.

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

Fields of IncomingConnectionError

remote_addr: Multiaddr

The remote multiaddr.

error: TransportError
OutgoingConnectionError

Fields of OutgoingConnectionError

peer_id: PeerId

The remote Peer Id.

error: SwarmError

The error that happened when dialing.

tid: usize
ListenAddressAdded(Multiaddr)

One of our listeners has a new address added.

ListenAddressDeleted(Multiaddr)

One of our listeners has an address deleted.

ListenerClosed

One of the listeners gracefully closed.

Seems unlikely, as least in async-std

Fields of ListenerClosed

addresses: Vec<Multiaddr>

The addresses that the listener was listening on.

reason: TransportError

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

PingResult

A Ping result generated by the Ping protocol handler.

Fields of PingResult

cid: ConnectionId

The connection Id.

result: Result<Duration, SwarmError>

The result. Duration means the TTL when succeeded, or SwarmError for failed.

IdentifyResult

An identify result generated by the Identify protocol handler.

Fields of IdentifyResult

cid: ConnectionId

The connection Id.

result: Result<(IdentifyInfo, Multiaddr), SwarmError>

The result. Duration means the TTL when succeeded, or SwarmError for failed.

Trait Implementations

impl Debug for SwarmEvent[src]

Auto Trait Implementations

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> Pointable for T[src]

type Init = T

The type for initializers.

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>,