pub struct ServerLimits {
pub max_connections: usize,
pub max_connections_per_peer: usize,
pub timeout: Duration,
pub max_requests_per_second: u32,
pub min_rate: u64,
pub max_bandwidth: Option<u64>,
pub max_peers: usize,
}Expand description
Resource limits of a server; the defaults suit a local network.
Fields§
§max_connections: usizeConcurrent connections in total.
max_connections_per_peer: usizeConcurrent connections per source address.
timeout: DurationPer read/write operation; also the whole budget for receiving the request line (and the TLS handshake before it).
max_requests_per_second: u32New connections per second per source address, sustained; a burst of twice as many is admitted (token bucket). One request is one connection, so this is also the piece rate one address can obtain; a sequential fetch with the adaptive piece sizes stays well below the default on a gigabit link (1 MiB pieces are about 120 per second).
min_rate: u64Bytes per second a client must at least consume: a response of L bytes has to be read
within max(timeout, L / min_rate), after which the connection is closed.
max_bandwidth: Option<u64>Bytes per second the server sends in total, across all connections (None: unlimited).
One token bucket holding one second of the rate, shared by every connection in arrival
order; the effective rate of one client is the cap divided by the active connections.
max_peers: usizeDistinct source addresses with at least one open connection; a further address is turned
away like an excess connection (503, silent in TLS mode) until one of them leaves.
Trait Implementations§
Source§impl Clone for ServerLimits
impl Clone for ServerLimits
impl Copy for ServerLimits
Source§impl Debug for ServerLimits
impl Debug for ServerLimits
Auto Trait Implementations§
impl Freeze for ServerLimits
impl RefUnwindSafe for ServerLimits
impl Send for ServerLimits
impl Sync for ServerLimits
impl Unpin for ServerLimits
impl UnsafeUnpin for ServerLimits
impl UnwindSafe for ServerLimits
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DefaultBoxed for Twhere
T: Default,
impl<T> DefaultBoxed for Twhere
T: Default,
Source§unsafe fn default_in_place(ptr: *mut T)
unsafe fn default_in_place(ptr: *mut T)
Source§fn default_boxed() -> Box<Self>where
Self: Sized,
fn default_boxed() -> Box<Self>where
Self: Sized,
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