diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-04-23 13:32:24 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-04-23 13:57:24 (GMT) |
commit | 18f4f0ba13bbfe901dae44e95d869ba0425e93c7 (patch) | |
tree | 51de477a7f2dc9aba3177e6ea50ed90dbff91f85 /Swiften/Network/PlatformDomainNameServiceQuery.cpp | |
parent | 2f64443e7a3e427a3a38665b5aafb77c9b128cc0 (diff) | |
download | swift-contrib-18f4f0ba13bbfe901dae44e95d869ba0425e93c7.zip swift-contrib-18f4f0ba13bbfe901dae44e95d869ba0425e93c7.tar.bz2 |
Select SRV randomly, taking weight into account.
Resolves: #1030
Diffstat (limited to 'Swiften/Network/PlatformDomainNameServiceQuery.cpp')
-rw-r--r-- | Swiften/Network/PlatformDomainNameServiceQuery.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp index 5d076ac..b0579a7 100644 --- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp +++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp @@ -29,6 +29,7 @@ #include <Swiften/Base/ByteArray.h> #include <Swiften/EventLoop/EventLoop.h> #include <Swiften/Base/foreach.h> +#include <Swiften/Base/BoostRandomGenerator.h> #include <Swiften/Base/Log.h> #include <Swiften/Network/PlatformDomainNameResolver.h> @@ -158,7 +159,8 @@ void PlatformDomainNameServiceQuery::runBlocking() { } #endif - std::sort(records.begin(), records.end(), ResultPriorityComparator()); + BoostRandomGenerator generator; + DomainNameServiceQuery::sortResults(records, generator); //std::cout << "Sending out " << records.size() << " SRV results " << std::endl; eventLoop->postEvent(boost::bind(boost::ref(onResult), records), shared_from_this()); } |