From 2b020adbee0be770c52f31699db793413d051bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Sun, 17 Jun 2012 10:16:04 +0200 Subject: CachingNameOnlyDomainNameResolver -> CachingDomainNameResolver. diff --git a/Swiften/Network/BOSHConnectionPool.cpp b/Swiften/Network/BOSHConnectionPool.cpp index 293bc1a..d0aa622 100644 --- a/Swiften/Network/BOSHConnectionPool.cpp +++ b/Swiften/Network/BOSHConnectionPool.cpp @@ -14,7 +14,7 @@ #include <Swiften/Base/SafeString.h> #include <Swiften/Network/TLSConnectionFactory.h> #include <Swiften/Network/HTTPConnectProxiedConnectionFactory.h> -#include <Swiften/Network/CachingNameOnlyDomainNameResolver.h> +#include <Swiften/Network/CachingDomainNameResolver.h> namespace Swift { BOSHConnectionPool::BOSHConnectionPool(const URL& boshURL, DomainNameResolver* realResolver, ConnectionFactory* connectionFactoryParameter, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, TimerFactory* timerFactory, EventLoop* eventLoop, const std::string& to, unsigned long long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword) : @@ -40,7 +40,7 @@ BOSHConnectionPool::BOSHConnectionPool(const URL& boshURL, DomainNameResolver* r connectionFactory = new TLSConnectionFactory(tlsFactory, connectionFactory); myConnectionFactories.push_back(connectionFactory); } - resolver = new CachingNameOnlyDomainNameResolver(realResolver, eventLoop); + resolver = new CachingDomainNameResolver(realResolver, eventLoop); createConnection(); } diff --git a/Swiften/Network/BOSHConnectionPool.h b/Swiften/Network/BOSHConnectionPool.h index 00c1e65..028a1f3 100644 --- a/Swiften/Network/BOSHConnectionPool.h +++ b/Swiften/Network/BOSHConnectionPool.h @@ -15,7 +15,7 @@ namespace Swift { class HTTPConnectProxiedConnectionFactory; class TLSConnectionFactory; - class CachingNameOnlyDomainNameResolver; + class CachingDomainNameResolver; class EventLoop; class BOSHConnectionPool : public boost::bsignals::trackable { @@ -64,6 +64,6 @@ namespace Swift { int restartCount; bool pendingRestart; std::vector<ConnectionFactory*> myConnectionFactories; - CachingNameOnlyDomainNameResolver* resolver; + CachingDomainNameResolver* resolver; }; } diff --git a/Swiften/Network/CachingDomainNameResolver.cpp b/Swiften/Network/CachingDomainNameResolver.cpp new file mode 100644 index 0000000..4cf8286 --- /dev/null +++ b/Swiften/Network/CachingDomainNameResolver.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2012 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Network/CachingDomainNameResolver.h> + +#include <boost/smart_ptr/make_shared.hpp> + +namespace Swift { + +CachingDomainNameResolver::CachingDomainNameResolver(DomainNameResolver* realResolver, EventLoop*) : realResolver(realResolver) { +} + +CachingDomainNameResolver::~CachingDomainNameResolver() { + +} + +DomainNameServiceQuery::ref CachingDomainNameResolver::createServiceQuery(const std::string& name) { + //TODO: Cache + return realResolver->createServiceQuery(name); +} + +DomainNameAddressQuery::ref CachingDomainNameResolver::createAddressQuery(const std::string& name) { + //TODO: Cache + return realResolver->createAddressQuery(name); +} + +} diff --git a/Swiften/Network/CachingDomainNameResolver.h b/Swiften/Network/CachingDomainNameResolver.h new file mode 100644 index 0000000..66b4d68 --- /dev/null +++ b/Swiften/Network/CachingDomainNameResolver.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2012 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/shared_ptr.hpp> + +#include <Swiften/Network/DomainNameResolver.h> +#include <Swiften/Network/StaticDomainNameResolver.h> + +/* + * FIXME: Does not do any caching yet. + */ +namespace Swift { + class EventLoop; + + class CachingDomainNameResolver : public DomainNameResolver { + public: + CachingDomainNameResolver(DomainNameResolver* realResolver, EventLoop* eventLoop); + ~CachingDomainNameResolver(); + + virtual DomainNameServiceQuery::ref createServiceQuery(const std::string& name); + virtual DomainNameAddressQuery::ref createAddressQuery(const std::string& name); + + private: + DomainNameResolver* realResolver; + }; +} diff --git a/Swiften/Network/CachingNameOnlyDomainNameResolver.cpp b/Swiften/Network/CachingNameOnlyDomainNameResolver.cpp deleted file mode 100644 index 8a2936a..0000000 --- a/Swiften/Network/CachingNameOnlyDomainNameResolver.cpp +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2012 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#include <Swiften/Network/CachingNameOnlyDomainNameResolver.h> - -#include <boost/smart_ptr/make_shared.hpp> - -namespace Swift { - -CachingNameOnlyDomainNameResolver::CachingNameOnlyDomainNameResolver(DomainNameResolver* realResolver, EventLoop*) : realResolver(realResolver) { -} - -CachingNameOnlyDomainNameResolver::~CachingNameOnlyDomainNameResolver() { - -} - -DomainNameServiceQuery::ref CachingNameOnlyDomainNameResolver::createServiceQuery(const std::string& name) { - //FIXME: Cache - return realResolver->createServiceQuery(name); -} - -DomainNameAddressQuery::ref CachingNameOnlyDomainNameResolver::createAddressQuery(const std::string& name) { - //FIXME: Cache - return realResolver->createAddressQuery(name); -} - -} diff --git a/Swiften/Network/CachingNameOnlyDomainNameResolver.h b/Swiften/Network/CachingNameOnlyDomainNameResolver.h deleted file mode 100644 index 2919271..0000000 --- a/Swiften/Network/CachingNameOnlyDomainNameResolver.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2012 Kevin Smith - * Licensed under the GNU General Public License v3. - * See Documentation/Licenses/GPLv3.txt for more information. - */ - -#pragma once - -#include <boost/shared_ptr.hpp> - -#include <Swiften/Network/DomainNameResolver.h> -#include <Swiften/Network/StaticDomainNameResolver.h> - -/* - * FIXME: Does not do any caching yet. - */ -namespace Swift { - class EventLoop; - - class CachingNameOnlyDomainNameResolver : public DomainNameResolver { - public: - CachingNameOnlyDomainNameResolver(DomainNameResolver* realResolver, EventLoop* eventLoop); - ~CachingNameOnlyDomainNameResolver(); - - virtual DomainNameServiceQuery::ref createServiceQuery(const std::string& name); - virtual DomainNameAddressQuery::ref createAddressQuery(const std::string& name); - - private: - DomainNameResolver* realResolver; - }; -} diff --git a/Swiften/Network/SConscript b/Swiften/Network/SConscript index ea45149..b742bfe 100644 --- a/Swiften/Network/SConscript +++ b/Swiften/Network/SConscript @@ -15,7 +15,7 @@ sourceList = [ "BoostIOServiceThread.cpp", "BOSHConnection.cpp", "BOSHConnectionPool.cpp", - "CachingNameOnlyDomainNameResolver.cpp", + "CachingDomainNameResolver.cpp", "ConnectionFactory.cpp", "ConnectionServer.cpp", "ConnectionServerFactory.cpp", -- cgit v0.10.2-6-g49f6