deltachat::net

Function run_connection_attempts

source
pub(crate) async fn run_connection_attempts<O, I, F>(futures: I) -> Result<O>
where I: Iterator<Item = F>, F: Future<Output = Result<O>> + Send + 'static, O: Send + 'static,
Expand description

Runs connection attempt futures.

Accepts iterator of connection attempt futures and runs them until one of them succeeds or all of them fail.

If all connection attempts fail, returns the first error.

This functions starts with one connection attempt and maintains up to five parallel connection attempts if connecting takes time.