pub(super) struct Connection {
streams: Receiver<Stream>,
shared: Arc<Shared>,
}Expand description
A connection a client upgraded to SPDY/3.1.
Fields§
§streams: Receiver<Stream>Implementations§
Source§impl Connection
impl Connection
Sourcepub(super) fn serve<T, F>(
io: T,
idle_timeout: Option<Duration>,
ping_interval: Option<Duration>,
accept: F,
) -> Self
pub(super) fn serve<T, F>( io: T, idle_timeout: Option<Duration>, ping_interval: Option<Duration>, accept: F, ) -> Self
Serve SPDY on the connection. The client opens streams, accept
decides about each by its headers, rejected ones get reset. The
connection ends when the client closes it, violates the protocol, a
write fails, like of a ping, or when it was idle for the timeout.
Nothing waits for the echoes of the pings. Only the frames of the
client keep the connection active, except for these echoes, and the
data of the server, not its control frames, see Self::is_activity.
Sourcepub(super) async fn accept(&mut self) -> Option<Stream>
pub(super) async fn accept(&mut self) -> Option<Stream>
The next stream the client opened, None once the connection ended.
Sourcepub(super) fn activity(&self) -> Activity
pub(super) fn activity(&self) -> Activity
When the connection was active the last time, for an idle timeout
which its user applies instead of Connection::serve, see there.
Sourcepub(super) fn handle(&self) -> ConnectionHandle
pub(super) fn handle(&self) -> ConnectionHandle
A handle to close the connection, while the connection itself still accepts streams.
Sourceasync fn ping(shared: Arc<Shared>, interval: Duration)
async fn ping(shared: Arc<Shared>, interval: Duration)
Ping the client until the connection ends. The pings of the server have even IDs, the client echoes them.
Sourcefn is_activity(frame: &Frame) -> bool
fn is_activity(frame: &Frame) -> bool
Whether a frame of the client keeps the connection from being idle,
which its answers to the pings of the server do not. Of the frames of
the server only data counts, see Self::write.
Sourceasync fn write<T>(
shared: Arc<Shared>,
writer: WriteHalf<T>,
encoder: Encoder,
control_rx: Receiver<Frame>,
data_rx: Receiver<QueuedData>,
)where
T: AsyncWrite,
async fn write<T>(
shared: Arc<Shared>,
writer: WriteHalf<T>,
encoder: Encoder,
control_rx: Receiver<Frame>,
data_rx: Receiver<QueuedData>,
)where
T: AsyncWrite,
Write the queued frames: control frames first, then the resets of streams without queued data, then data. The data frames of a stream keep their order, its FIN goes through the same queue, and a reset of a stream with queued data follows its last frame. A reset follows the SYN_REPLY of its stream, which is queued before the stream exists.
Sourceasync fn write_buf<W>(
writer: &mut W,
buf: &[u8],
written: &Activity,
) -> Result<()>where
W: AsyncWrite + Unpin,
async fn write_buf<W>(
writer: &mut W,
buf: &[u8],
written: &Activity,
) -> Result<()>where
W: AsyncWrite + Unpin,
Write all of buf, written gets touched by every part which went
out, so that the end of the connection waits for a client which takes
the frames slowly, see ConnectionHandle::written.
Sourcefn encode_data(
encoder: &mut Encoder,
data: &QueuedData,
buf: &mut BytesMut,
) -> Result<()>
fn encode_data( encoder: &mut Encoder, data: &QueuedData, buf: &mut BytesMut, ) -> Result<()>
Encode a data frame, followed by the reset of its stream if it was the last data the stream queued before its reset.
fn reset_frame(stream_id: u32) -> Frame
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl UnwindSafe for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].