struct Shared {
control: Sender<Frame>,
data: Sender<QueuedData>,
streams: Mutex<HashMap<u32, StreamState>>,
budget: Budget,
resets: Mutex<Vec<u32>>,
resets_ready: Notify,
closing: CancellationToken,
done: CancellationToken,
activity: Activity,
written: Activity,
last_stream_id: AtomicU32,
live_streams: AtomicUsize,
}Expand description
What the reader, the writer and the streams of a connection share.
Fields§
§control: Sender<Frame>§data: Sender<QueuedData>§streams: Mutex<HashMap<u32, StreamState>>§budget: BudgetThe bytes of the client all streams hold, see DATA_BUFFER.
resets: Mutex<Vec<u32>>The streams the server reset without queued data, which the writer sends next. Unlike the control queue it cannot be full, a stream gets reset only once.
resets_ready: Notify§closing: CancellationTokenCancelled once the server closes the connection after the frames queued until then.
done: CancellationTokenCancelled once the connection ended.
activity: ActivityWhen the last frame got read or written, for the idle timeout.
written: ActivityWhen a part of the frames of the server went out the last time, see
ConnectionHandle::written.
last_stream_id: AtomicU32The last stream the client opened, for the GOAWAY.
live_streams: AtomicUsizeThe streams the server holds, see Live.
Implementations§
fn lock_streams(&self) -> MutexGuard<'_, HashMap<u32, StreamState>>
Sourcefn queue_reset(&self, id: u32)
fn queue_reset(&self, id: u32)
Queue the reset of a stream for the writer.
fn take_resets(&self) -> Vec<u32>
Sourcefn remote_closed(&self, id: u32)
fn remote_closed(&self, id: u32)
The client closed its side of the stream.
Sourcefn local_closed(&self, id: u32)
fn local_closed(&self, id: u32)
The server closed its side of the stream.
Sourceasync fn deliver(&self, stream_id: u32, data: Bytes)
async fn deliver(&self, stream_id: u32, data: Bytes)
Hand the data of the client to its stream. Waits while the stream does not take it or the streams hold all of the budget, which stops reading the connection.
async fn send_control(&self, frame: Frame) -> Result<()>
Sourcefn go_away(&self, status: u32)
fn go_away(&self, status: u32)
End the connection with a GOAWAY, which the writer sends on its way out unless the client does not read anymore.
Sourcefn has_room(&self) -> bool
fn has_room(&self) -> bool
Whether the client may open another stream, see MAX_STREAMS.
Auto Trait Implementations§
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].