Struct IdleTimeout
pub struct IdleTimeout {
pub first_request: Duration,
pub idle: Duration,
}http-backend and http and std only.Expand description
Budget for a connection without open requests before it is closed.
A connection is idle while it has no open request, no request head in progress and no tunnel; a WebSocket, a CONNECT tunnel or a streamed response keeps its request open, even while no bytes are transferred. HTTP/2 PINGs and other connection-level control traffic do not restart this HTTP idle budget. Transport timeouts (including QUIC’s idle timeout) apply independently.
A connection that never received a complete request head gets one
first_request window, counted from when
it first went idle: requests and heads in progress pause it but never restart
it. Once a complete head arrived, the connection earns the full
idle budget whenever it becomes idle again. This allows a
client to reuse the connection between requests, including through an HTTP
interception proxy.
HTTP/1 closes the connection; HTTP/2 and HTTP/3 send a graceful GOAWAY
and close once requests that raced it are done.
Fields§
§first_request: DurationWindow for a connection that has not received a complete request head yet.
Extended by four round trips, at most doubled, when the connection measured its round-trip time.
idle: DurationBudget while idle after at least one complete request head was received.
Starts when no request, response, tunnel or request head remains open,
rather than when the last byte was transferred. Defaults to 90 seconds.
Increase this for clients with longer gaps between requests using, for
example, IdleTimeout { idle: Duration::from_secs(300), ..IdleTimeout::DEFAULT }.
Implementations§
§impl IdleTimeout
impl IdleTimeout
pub const DEFAULT: IdleTimeout
pub const DEFAULT: IdleTimeout
10 s before the first request and 90 s idle after receiving a request head.
The shorter initial window limits unused connections. The longer window allows reuse across minute-spaced requests, reducing reconnects and TLS handshakes for clients and HTTP interception proxies.
Trait Implementations§
§impl Clone for IdleTimeout
impl Clone for IdleTimeout
§fn clone(&self) -> IdleTimeout
fn clone(&self) -> IdleTimeout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for IdleTimeout
§impl Debug for IdleTimeout
impl Debug for IdleTimeout
§impl Default for IdleTimeout
impl Default for IdleTimeout
§fn default() -> IdleTimeout
fn default() -> IdleTimeout
impl Eq for IdleTimeout
§impl PartialEq for IdleTimeout
impl PartialEq for IdleTimeout
impl StructuralPartialEq for IdleTimeout
Auto Trait Implementations§
impl Forget for IdleTimeout
impl Freeze for IdleTimeout
impl RefUnwindSafe for IdleTimeout
impl Send for IdleTimeout
impl Sync for IdleTimeout
impl Unpin for IdleTimeout
impl UnsafeUnpin for IdleTimeout
impl UnwindSafe for IdleTimeout
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§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 rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more