summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-18 11:57:45 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-18 11:57:45 (GMT)
commit790dd3e97c6634f6a256f2e072507b9d5f29348b (patch)
treefbc9f84e324e1abba197e786956442ac3b47979d /Swiften
parent82a34212908a749964deb419e6baf476a247ed84 (diff)
downloadswift-790dd3e97c6634f6a256f2e072507b9d5f29348b.zip
swift-790dd3e97c6634f6a256f2e072507b9d5f29348b.tar.bz2
Move domain name resolver in the network factories.
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Client/CoreClient.cpp4
-rw-r--r--Swiften/Client/CoreClient.h1
-rw-r--r--Swiften/Network/BoostNetworkFactories.cpp5
-rw-r--r--Swiften/Network/BoostNetworkFactories.h5
-rw-r--r--Swiften/Network/NetworkFactories.h2
5 files changed, 13 insertions, 4 deletions
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index e61f9f9..b2bbad8 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -22,7 +22,7 @@
namespace Swift {
-CoreClient::CoreClient(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const String& password) : resolver_(eventLoop), jid_(jid), password_(password), eventLoop(eventLoop), networkFactories(networkFactories), disconnectRequested_(false), certificateTrustChecker(NULL) {
+CoreClient::CoreClient(EventLoop* eventLoop, NetworkFactories* networkFactories, const JID& jid, const String& password) : jid_(jid), password_(password), eventLoop(eventLoop), networkFactories(networkFactories), disconnectRequested_(false), certificateTrustChecker(NULL) {
stanzaChannel_ = new ClientSessionStanzaChannel();
stanzaChannel_->onMessageReceived.connect(boost::ref(onMessageReceived));
stanzaChannel_->onPresenceReceived.connect(boost::ref(onPresenceReceived));
@@ -56,7 +56,7 @@ void CoreClient::connect(const String& host) {
SWIFT_LOG(debug) << "Connecting to host " << host << std::endl;
disconnectRequested_ = false;
assert(!connector_);
- connector_ = Connector::create(host, &resolver_, networkFactories->getConnectionFactory(), networkFactories->getTimerFactory());
+ connector_ = Connector::create(host, networkFactories->getDomainNameResolver(), networkFactories->getConnectionFactory(), networkFactories->getTimerFactory());
connector_->onConnectFinished.connect(boost::bind(&CoreClient::handleConnectorFinished, this, _1));
connector_->setTimeoutMilliseconds(60*1000);
connector_->start();
diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h
index a0c7092..925a357 100644
--- a/Swiften/Client/CoreClient.h
+++ b/Swiften/Client/CoreClient.h
@@ -202,7 +202,6 @@ namespace Swift {
void handleDataWritten(const String&);
private:
- PlatformDomainNameResolver resolver_;
JID jid_;
String password_;
EventLoop* eventLoop;
diff --git a/Swiften/Network/BoostNetworkFactories.cpp b/Swiften/Network/BoostNetworkFactories.cpp
index fc52b08..b9d5b49 100644
--- a/Swiften/Network/BoostNetworkFactories.cpp
+++ b/Swiften/Network/BoostNetworkFactories.cpp
@@ -7,15 +7,18 @@
#include "Swiften/Network/BoostNetworkFactories.h"
#include "Swiften/Network/BoostTimerFactory.h"
#include "Swiften/Network/BoostConnectionFactory.h"
+#include <Swiften/Network/PlatformDomainNameResolver.h>
namespace Swift {
BoostNetworkFactories::BoostNetworkFactories(EventLoop* eventLoop) {
timerFactory = new BoostTimerFactory(&ioServiceThread.getIOService(), eventLoop);
- connectionFactory = new BoostConnectionFactory(&ioServiceThread.getIOService(), eventLoop);
+ connectionFactory = new BoostConnectionFactory(&ioServiceThread.getIOService(), eventLoop);
+ domainNameResolver = new PlatformDomainNameResolver(eventLoop);
}
BoostNetworkFactories::~BoostNetworkFactories() {
+ delete domainNameResolver;
delete connectionFactory;
delete timerFactory;
}
diff --git a/Swiften/Network/BoostNetworkFactories.h b/Swiften/Network/BoostNetworkFactories.h
index 3f8b557..cb7e359 100644
--- a/Swiften/Network/BoostNetworkFactories.h
+++ b/Swiften/Network/BoostNetworkFactories.h
@@ -29,9 +29,14 @@ namespace Swift {
return &ioServiceThread;
}
+ DomainNameResolver* getDomainNameResolver() const {
+ return domainNameResolver;
+ }
+
private:
BoostIOServiceThread ioServiceThread;
TimerFactory* timerFactory;
ConnectionFactory* connectionFactory;
+ DomainNameResolver* domainNameResolver;
};
}
diff --git a/Swiften/Network/NetworkFactories.h b/Swiften/Network/NetworkFactories.h
index 23e2780..b4400bd 100644
--- a/Swiften/Network/NetworkFactories.h
+++ b/Swiften/Network/NetworkFactories.h
@@ -9,6 +9,7 @@
namespace Swift {
class TimerFactory;
class ConnectionFactory;
+ class DomainNameResolver;
/**
* An interface collecting network factories.
@@ -19,5 +20,6 @@ namespace Swift {
virtual TimerFactory* getTimerFactory() const = 0;
virtual ConnectionFactory* getConnectionFactory() const = 0;
+ virtual DomainNameResolver* getDomainNameResolver() const = 0;
};
}