aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-01 22:37:05 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-01 22:37:05 +0000
commit76f7576840010da4848f29c6ac7bdc11d039b09c (patch)
treeb819f4727fdddf9a29ff4bfdacd4c0cff6e0f7de
parenta0ea048d7b8d4f0677e9a0dfc3b635fcddebeace (diff)
downloadpaludis-76f7576840010da4848f29c6ac7bdc11d039b09c.tar.gz
paludis-76f7576840010da4848f29c6ac7bdc11d039b09c.tar.xz
Select up to five random mirror entries. Don't try them all, it gets stupidly slow.
-rw-r--r--paludis/portage_repository.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index 33edcc8..2b92752 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -887,9 +887,16 @@ PortageRepository::do_is_mirror(const std::string & s) const
std::vector<std::string> entries;
tokeniser.tokenise(*line, std::back_inserter(entries));
if (! entries.empty())
+ {
+ /* pick up to five random mirrors only */
+ /// \todo param this
+ std::random_shuffle(next(entries.begin()), entries.end());
+ if (entries.size() > 6)
+ entries.resize(6);
_imp->mirrors.insert(std::make_pair(
entries.at(0),
std::list<std::string>(next(entries.begin()), entries.end())));
+ }
}
_imp->has_mirrors = true;
}