summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Client/CoreClient.cpp5
-rw-r--r--Swiften/Client/CoreClient.h2
-rw-r--r--Swiften/Network/BoostNetworkFactories.cpp7
-rw-r--r--Swiften/Network/BoostNetworkFactories.h4
-rw-r--r--Swiften/Network/NetworkFactories.h3
5 files changed, 15 insertions, 6 deletions
diff --git a/Swiften/Client/CoreClient.cpp b/Swiften/Client/CoreClient.cpp
index 22e3612..2a66905 100644
--- a/Swiften/Client/CoreClient.cpp
+++ b/Swiften/Client/CoreClient.cpp
@@ -14,7 +14,6 @@
#include <Swiften/Base/foreach.h>
#include <Swiften/Base/Algorithm.h>
#include <Swiften/Client/ClientSession.h>
-#include <Swiften/TLS/PlatformTLSFactories.h>
#include <Swiften/TLS/CertificateVerificationError.h>
#include <Swiften/Network/ChainedConnector.h>
#include <Swiften/Network/NetworkFactories.h>
@@ -37,12 +36,10 @@ CoreClient::CoreClient(const JID& jid, const SafeByteArray& password, NetworkFac
iqRouter_ = new IQRouter(stanzaChannel_);
iqRouter_->setJID(jid);
- tlsFactories = new PlatformTLSFactories();
}
CoreClient::~CoreClient() {
forceReset();
- delete tlsFactories;
delete iqRouter_;
stanzaChannel_->onAvailableChanged.disconnect(boost::bind(&CoreClient::handleStanzaChannelAvailableChanged, this, _1));
@@ -94,7 +91,7 @@ void CoreClient::handleConnectorFinished(boost::shared_ptr<Connection> connectio
connection_ = connection;
assert(!sessionStream_);
- sessionStream_ = boost::make_shared<BasicSessionStream>(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), tlsFactories->getTLSContextFactory(), networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory());
+ sessionStream_ = boost::make_shared<BasicSessionStream>(ClientStreamType, connection_, getPayloadParserFactories(), getPayloadSerializers(), networkFactories->getTLSContextFactory(), networkFactories->getTimerFactory(), networkFactories->getXMLParserFactory());
if (!certificate_.empty()) {
sessionStream_->setTLSCertificate(PKCS12Certificate(certificate_, password_));
}
diff --git a/Swiften/Client/CoreClient.h b/Swiften/Client/CoreClient.h
index ad31e72..3c089c1 100644
--- a/Swiften/Client/CoreClient.h
+++ b/Swiften/Client/CoreClient.h
@@ -30,7 +30,6 @@ namespace Swift {
class StanzaChannel;
class Stanza;
class BasicSessionStream;
- class PlatformTLSFactories;
class CertificateTrustChecker;
class NetworkFactories;
class ClientSessionStanzaChannel;
@@ -222,7 +221,6 @@ namespace Swift {
ClientOptions options;
boost::shared_ptr<ChainedConnector> connector_;
std::vector<ConnectionFactory*> proxyConnectionFactories;
- PlatformTLSFactories* tlsFactories;
boost::shared_ptr<Connection> connection_;
boost::shared_ptr<BasicSessionStream> sessionStream_;
boost::shared_ptr<ClientSession> session_;
diff --git a/Swiften/Network/BoostNetworkFactories.cpp b/Swiften/Network/BoostNetworkFactories.cpp
index 56be2b7..030fd49 100644
--- a/Swiften/Network/BoostNetworkFactories.cpp
+++ b/Swiften/Network/BoostNetworkFactories.cpp
@@ -12,6 +12,7 @@
#include <Swiften/Network/PlatformNATTraversalWorker.h>
#include <Swiften/Parser/PlatformXMLParserFactory.h>
#include <Swiften/Network/NullNATTraverser.h>
+#include <Swiften/TLS/PlatformTLSFactories.h>
namespace Swift {
@@ -26,9 +27,15 @@ BoostNetworkFactories::BoostNetworkFactories(EventLoop* eventLoop) {
natTraverser = new NullNATTraverser(eventLoop);
#endif
xmlParserFactory = new PlatformXMLParserFactory();
+ tlsFactories = new PlatformTLSFactories();
+}
+
+TLSContextFactory* BoostNetworkFactories::getTLSContextFactory() const {
+ return tlsFactories->getTLSContextFactory();
}
BoostNetworkFactories::~BoostNetworkFactories() {
+ delete tlsFactories;
delete xmlParserFactory;
delete natTraverser;
delete connectionServerFactory;
diff --git a/Swiften/Network/BoostNetworkFactories.h b/Swiften/Network/BoostNetworkFactories.h
index c9ecb59..8f2b17a 100644
--- a/Swiften/Network/BoostNetworkFactories.h
+++ b/Swiften/Network/BoostNetworkFactories.h
@@ -12,6 +12,7 @@
namespace Swift {
class EventLoop;
class NATTraverser;
+ class PlatformTLSFactories;
class BoostNetworkFactories : public NetworkFactories {
public:
@@ -46,6 +47,8 @@ namespace Swift {
return xmlParserFactory;
}
+ virtual TLSContextFactory* getTLSContextFactory() const;
+
private:
BoostIOServiceThread ioServiceThread;
TimerFactory* timerFactory;
@@ -54,5 +57,6 @@ namespace Swift {
ConnectionServerFactory* connectionServerFactory;
NATTraverser* natTraverser;
XMLParserFactory* xmlParserFactory;
+ PlatformTLSFactories* tlsFactories;
};
}
diff --git a/Swiften/Network/NetworkFactories.h b/Swiften/Network/NetworkFactories.h
index 42c9f6a..2404460 100644
--- a/Swiften/Network/NetworkFactories.h
+++ b/Swiften/Network/NetworkFactories.h
@@ -13,6 +13,8 @@ namespace Swift {
class ConnectionServerFactory;
class NATTraverser;
class XMLParserFactory;
+ class TLSContextFactory;
+ class CertificateFactory;
/**
* An interface collecting network factories.
@@ -27,5 +29,6 @@ namespace Swift {
virtual ConnectionServerFactory* getConnectionServerFactory() const = 0;
virtual NATTraverser* getNATTraverser() const = 0;
virtual XMLParserFactory* getXMLParserFactory() const = 0;
+ virtual TLSContextFactory* getTLSContextFactory() const = 0;
};
}