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

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

Created for each active connection; used by the protocols to obtain a handle for reading and writing, and keeps track of tasks that have been spawned for the purposes of the connection.

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 for the connection.

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more