fn overload_drop_connection_probability(
now: Instant,
prev: Option<Instant>,
) -> f32
Expand description
Returns the probability of dropping a connection where the last overload was at prev
,
and the current overload is now
.
§Security
Connections that haven’t seen an overload error in the past OVERLOAD_PROTECTION_INTERVAL have a small chance of being closed (MIN_OVERLOAD_DROP_PROBABILITY).
Connections that have seen a previous overload error in that time have a higher chance of being dropped up to MAX_OVERLOAD_DROP_PROBABILITY. This probability increases quadratically, so peers that send lots of inbound requests are more likely to be dropped.
§Examples
If a connection sends multiple overloads close together, it is very likely to be disconnected. If a connection has two overloads multiple seconds apart, it is unlikely to be disconnected.