summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-12-22 15:46:23 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-12-22 16:53:18 (GMT)
commit732253a9b3e88b99b36dd3298157cf502f743294 (patch)
tree3471f2d999dfe3cb2ae8f5aec5bdd7b3d1465078 /Swiften/Network/BOSHConnectionPool.cpp
parent6c1e7d8a8339a849896566464bd9f1db33e3b3da (diff)
downloadswift-contrib-732253a9b3e88b99b36dd3298157cf502f743294.zip
swift-contrib-732253a9b3e88b99b36dd3298157cf502f743294.tar.bz2
BOSH Refactoring.
Diffstat (limited to 'Swiften/Network/BOSHConnectionPool.cpp')
-rw-r--r--Swiften/Network/BOSHConnectionPool.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/Swiften/Network/BOSHConnectionPool.cpp b/Swiften/Network/BOSHConnectionPool.cpp
index 6c3ba7e..4886ede 100644
--- a/Swiften/Network/BOSHConnectionPool.cpp
+++ b/Swiften/Network/BOSHConnectionPool.cpp
@@ -16,8 +16,11 @@
#include <Swiften/Network/HTTPConnectProxiedConnectionFactory.h>
namespace Swift {
-BOSHConnectionPool::BOSHConnectionPool(boost::shared_ptr<BOSHConnectionFactory> connectionFactory, const std::string& to, long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword)
- : connectionFactory(connectionFactory),
+BOSHConnectionPool::BOSHConnectionPool(const URL& boshURL, ConnectionFactory* connectionFactory, XMLParserFactory* parserFactory, TLSContextFactory* tlsFactory, const std::string& to, long initialRID, const URL& boshHTTPConnectProxyURL, const SafeString& boshHTTPConnectProxyAuthID, const SafeString& boshHTTPConnectProxyAuthPassword) :
+ boshURL(boshURL),
+ connectionFactory(connectionFactory),
+ xmlParserFactory(parserFactory),
+ tlsFactory(tlsFactory),
rid(initialRID),
pendingTerminate(false),
to(to),
@@ -29,9 +32,9 @@ BOSHConnectionPool::BOSHConnectionPool(boost::shared_ptr<BOSHConnectionFactory>
connectProxyFactory = NULL;
}
else {
- ConnectionFactory* rawFactory = connectionFactory->getRawConnectionFactory();
+ ConnectionFactory* rawFactory = connectionFactory;
if (boshHTTPConnectProxyURL.getScheme() == "https") {
- tlsConnectionFactory = new TLSConnectionFactory(connectionFactory->getTLSContextFactory(), rawFactory);
+ tlsConnectionFactory = new TLSConnectionFactory(tlsFactory, rawFactory);
rawFactory = tlsConnectionFactory;
}
connectProxyFactory = new HTTPConnectProxiedConnectionFactory(rawFactory, HostAddressPort(HostAddress(boshHTTPConnectProxyURL.getHost()), boshHTTPConnectProxyURL.getPort()), boshHTTPConnectProxyAuthID, boshHTTPConnectProxyAuthPassword);
@@ -206,7 +209,7 @@ void BOSHConnectionPool::handleConnectionDisconnected(const boost::optional<Conn
}
boost::shared_ptr<BOSHConnection> BOSHConnectionPool::createConnection() {
- BOSHConnection::ref connection = boost::dynamic_pointer_cast<BOSHConnection>(connectionFactory->createConnection(connectProxyFactory));
+ BOSHConnection::ref connection = BOSHConnection::create(boshURL, connectProxyFactory ? connectProxyFactory : connectionFactory, xmlParserFactory, tlsFactory);
connection->onXMPPDataRead.connect(boost::bind(&BOSHConnectionPool::handleDataRead, this, _1));
connection->onSessionStarted.connect(boost::bind(&BOSHConnectionPool::handleSessionStarted, this, _1, _2));
connection->onBOSHDataRead.connect(boost::bind(&BOSHConnectionPool::handleBOSHDataRead, this, _1));