Skip to content

Commit 6dfca3e

Browse files
committed
API: Fix non total ordering of download entries
1 parent 9a5b50d commit 6dfca3e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

portablemc/src/download.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,13 @@ async fn download_many(
622622
// Sort our entries in order to download big files first, this is allowing better
623623
// parallelization at start and avoid too much blocking at the end. Because our
624624
// indices vector will pop the first index from the end, we put big files at the
625-
// end, and so sort by ascending size.
625+
// end, and so sort by ascending size. We also put
626626
indices.sort_by(|&a_index, &b_index| {
627627
match (entries[a_index].expected_size, entries[b_index].expected_size) {
628628
(Some(a), Some(b)) => Ord::cmp(&a, &b),
629-
_ => Ordering::Equal,
629+
(Some(_), None) => Ordering::Less,
630+
(None, Some(_)) => Ordering::Greater,
631+
(None, None) => Ordering::Equal,
630632
}
631633
});
632634

0 commit comments

Comments
 (0)