Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,6 @@ where
let mut all_errors = Vec::new();

let res = loop {
if let Some(fut) = futures.next() {
connection_attempt_set.spawn(fut);
}

tokio::select! {
biased;

Expand All @@ -209,14 +205,18 @@ where
}
}
None => {
// Out of connection attempts.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment here was wrong, it was possible that we have empty connection_attempt_set, but non-empty futures.

//
// Break out of the loop and return error.
break if all_errors.is_empty() {
Err(format_err!("No connection attempts were made"))
if let Some(fut) = futures.next() {
connection_attempt_set.spawn(fut);
} else {
Err(format_err!("All connection attempts failed: {}", all_errors.into_iter().map(|err| format!("{err:#}")).collect::<Vec<String>>().join("; ")))
};
// Out of connection attempts.
//
// Break out of the loop and return error.
break if all_errors.is_empty() {
Err(format_err!("No connection attempts were made"))
} else {
Err(format_err!("All connection attempts failed: {}", all_errors.into_iter().map(|err| format!("{err:#}")).collect::<Vec<String>>().join("; ")))
};
}
}
}
},
Expand Down
Loading