Struct pea2pea::connections::Connection[][src]

pub struct Connection {
    pub addr: SocketAddr,
    pub reader: Option<OwnedReadHalf>,
    pub writer: Option<OwnedWriteHalf>,
    pub tasks: Vec<JoinHandle<()>>,
    pub outbound_message_sender: Option<Sender<Bytes>>,
    pub side: ConnectionSide,
}
Expand description

Keeps track of tasks that have been spawned for the purposes of a connection; it also contains a sender that communicates with the Writing protocol handler.

Fields

addr: SocketAddr

The address of the connection.

reader: Option<OwnedReadHalf>

Kept only until the protocols are enabled (Reading should take() it).

writer: Option<OwnedWriteHalf>

Kept only until the protocols are enabled (Writing should take() it).

tasks: Vec<JoinHandle<()>>

Handles to tasks spawned by the connection.

outbound_message_sender: Option<Sender<Bytes>>

Used to queue writes to the stream.

side: ConnectionSide

The connection’s side in relation to the node.

Implementations

Provides mutable access to the underlying reader; it should only be used in protocol definitions.

Provides mutable access to the underlying writer; it should only be used in protocol definitions.

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.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

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.