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/DomainNameServiceQuery.h | |
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/DomainNameServiceQuery.h')
-rw-r--r-- | Swiften/Network/DomainNameServiceQuery.h | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Swiften/Network/DomainNameServiceQuery.h b/Swiften/Network/DomainNameServiceQuery.h index 0bd1569..0e80233 100644 --- a/Swiften/Network/DomainNameServiceQuery.h +++ b/Swiften/Network/DomainNameServiceQuery.h @@ -15,6 +15,8 @@ #include <Swiften/Network/DomainNameResolveError.h> namespace Swift { + class RandomGenerator; + class DomainNameServiceQuery { public: typedef boost::shared_ptr<DomainNameServiceQuery> ref; @@ -27,15 +29,10 @@ namespace Swift { int weight; }; - struct ResultPriorityComparator { - bool operator()(const DomainNameServiceQuery::Result& a, const DomainNameServiceQuery::Result& b) const { - return a.priority < b.priority; - } - }; - virtual ~DomainNameServiceQuery(); virtual void run() = 0; + static void sortResults(std::vector<DomainNameServiceQuery::Result>& queries, RandomGenerator& generator); boost::signal<void (const std::vector<Result>&)> onResult; }; |