Skip to main content

accept_error_backoff

Function accept_error_backoff 

Source
pub async fn accept_error_backoff<S>(err: &Error, stopped: S) -> Option<S>
where S: Future + Unpin,
Expand description

Pauses an accept loop after accept failed with err.

Errors that concern only the connection being accepted (refused, aborted or reset) return at once. Any other error, such as running out of file descriptors, persists and would make the loop spin, so it is followed by a one second sleep.

Returns the stopped future to keep polling, or None if it resolved during the sleep and the loop must exit.