summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/PlatformDomainNameServiceQuery.cpp')
-rw-r--r--Swiften/Network/PlatformDomainNameServiceQuery.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Swiften/Network/PlatformDomainNameServiceQuery.cpp b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
index 5cffcdb..a5d180b 100644
--- a/Swiften/Network/PlatformDomainNameServiceQuery.cpp
+++ b/Swiften/Network/PlatformDomainNameServiceQuery.cpp
@@ -2,62 +2,62 @@
* Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <boost/asio.hpp>
#include <Swiften/Network/PlatformDomainNameServiceQuery.h>
#pragma GCC diagnostic ignored "-Wold-style-cast"
#include <Swiften/Base/Platform.h>
#include <stdlib.h>
#include <boost/numeric/conversion/cast.hpp>
#ifdef SWIFTEN_PLATFORM_WINDOWS
#undef UNICODE
#include <windows.h>
#include <windns.h>
#ifndef DNS_TYPE_SRV
#define DNS_TYPE_SRV 33
#endif
#else
#include <arpa/nameser.h>
#include <arpa/nameser_compat.h>
#include <resolv.h>
#endif
#include <boost/bind.hpp>
#include <Swiften/Base/ByteArray.h>
#include <Swiften/EventLoop/EventLoop.h>
-#include <Swiften/Base/BoostRandomGenerator.h>
#include <Swiften/Base/Log.h>
+#include <Swiften/Base/StdRandomGenerator.h>
#include <Swiften/Network/PlatformDomainNameResolver.h>
using namespace Swift;
namespace Swift {
PlatformDomainNameServiceQuery::PlatformDomainNameServiceQuery(const boost::optional<std::string>& serviceName, EventLoop* eventLoop, PlatformDomainNameResolver* resolver) : PlatformDomainNameQuery(resolver), eventLoop(eventLoop), serviceValid(false) {
if (!!serviceName) {
service = *serviceName;
serviceValid = true;
}
}
PlatformDomainNameServiceQuery::~PlatformDomainNameServiceQuery() {
}
void PlatformDomainNameServiceQuery::run() {
getResolver()->addQueryToQueue(shared_from_this());
}
void PlatformDomainNameServiceQuery::runBlocking() {
if (!serviceValid) {
emitError();
return;
}
SWIFT_LOG(debug) << "Querying " << service << std::endl;
std::vector<DomainNameServiceQuery::Result> records;
@@ -145,41 +145,41 @@ void PlatformDomainNameServiceQuery::runBlocking() {
record.weight = boost::numeric_cast<int>(ns_get16(currentEntry));
currentEntry += 2;
// Port
if (currentEntry + 2 >= messageEnd) {
emitError();
return;
}
record.port = boost::numeric_cast<int>(ns_get16(currentEntry));
currentEntry += 2;
// Hostname
if (currentEntry >= messageEnd) {
emitError();
return;
}
ByteArray entry;
entry.resize(NS_MAXDNAME);
entryLength = dn_expand(messageStart, messageEnd, currentEntry, reinterpret_cast<char*>(vecptr(entry)), entry.size());
if (entryLength < 0) {
emitError();
return;
}
record.hostname = std::string(reinterpret_cast<const char*>(vecptr(entry)));
records.push_back(record);
currentEntry += entryLength;
answersCount--;
}
#endif
- BoostRandomGenerator generator;
+ StdRandomGenerator 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());
}
void PlatformDomainNameServiceQuery::emitError() {
eventLoop->postEvent(boost::bind(boost::ref(onResult), std::vector<DomainNameServiceQuery::Result>()), shared_from_this());
}
}