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/Session
parent6c1e7d8a8339a849896566464bd9f1db33e3b3da (diff)
downloadswift-contrib-732253a9b3e88b99b36dd3298157cf502f743294.zip
swift-contrib-732253a9b3e88b99b36dd3298157cf502f743294.tar.bz2
BOSH Refactoring.
Diffstat (limited to 'Swiften/Session')
-rw-r--r--Swiften/Session/BOSHSessionStream.cpp10
-rw-r--r--Swiften/Session/BOSHSessionStream.h24
2 files changed, 17 insertions, 17 deletions
diff --git a/Swiften/Session/BOSHSessionStream.cpp b/Swiften/Session/BOSHSessionStream.cpp
index 73bbfd6..f53b8e1 100644
--- a/Swiften/Session/BOSHSessionStream.cpp
+++ b/Swiften/Session/BOSHSessionStream.cpp
@@ -27,9 +27,10 @@
namespace Swift {
BOSHSessionStream::BOSHSessionStream(
- boost::shared_ptr<BOSHConnectionFactory> connectionFactory, /*FIXME: probably rip out*/
+ const URL& boshURL,
PayloadParserFactoryCollection* payloadParserFactories,
PayloadSerializerCollection* payloadSerializers,
+ ConnectionFactory* connectionFactory,
TLSContextFactory* tlsContextFactory,
TimerFactory* timerFactory,
XMLParserFactory* xmlParserFactory,
@@ -48,12 +49,11 @@ BOSHSessionStream::BOSHSessionStream(
firstHeader(true) {
boost::mt19937 random;
- boost::uniform_int<long> dist(0, LONG_MAX);
+ boost::uniform_int<long long> dist(0, (1LL<<53) - 1);
random.seed(time(NULL));
- boost::variate_generator<boost::mt19937&, boost::uniform_int<long> > randomRID(random, dist);
- long initialRID = randomRID();
+ long long initialRID = boost::variate_generator<boost::mt19937&, boost::uniform_int<long long> >(random, dist)();
- connectionPool = new BOSHConnectionPool(connectionFactory, to, initialRID, boshHTTPConnectProxyURL, boshHTTPConnectProxyAuthID, boshHTTPConnectProxyAuthPassword);
+ connectionPool = new BOSHConnectionPool(boshURL, connectionFactory, xmlParserFactory, tlsContextFactory, to, initialRID, boshHTTPConnectProxyURL, boshHTTPConnectProxyAuthID, boshHTTPConnectProxyAuthPassword);
connectionPool->onSessionTerminated.connect(boost::bind(&BOSHSessionStream::handlePoolSessionTerminated, this, _1));
connectionPool->onSessionStarted.connect(boost::bind(&BOSHSessionStream::handlePoolSessionStarted, this));
connectionPool->onXMPPDataRead.connect(boost::bind(&BOSHSessionStream::handlePoolXMPPDataRead, this, _1));
diff --git a/Swiften/Session/BOSHSessionStream.h b/Swiften/Session/BOSHSessionStream.h
index 75c1f2a..c3f6220 100644
--- a/Swiften/Session/BOSHSessionStream.h
+++ b/Swiften/Session/BOSHSessionStream.h
@@ -11,7 +11,6 @@
#include <Swiften/Base/SafeString.h>
#include <Swiften/Base/SafeByteArray.h>
#include <Swiften/Network/BOSHConnectionPool.h>
-#include <Swiften/Network/BOSHConnectionFactory.h>
#include <Swiften/Session/SessionStream.h>
#include <Swiften/Elements/StreamType.h>
#include <Swiften/EventLoop/EventOwner.h>
@@ -31,17 +30,18 @@ namespace Swift {
class BOSHSessionStream : public SessionStream, public EventOwner, public boost::enable_shared_from_this<BOSHSessionStream> {
public:
BOSHSessionStream(
- boost::shared_ptr<BOSHConnectionFactory> connectionFactory,
- PayloadParserFactoryCollection* payloadParserFactories,
- PayloadSerializerCollection* payloadSerializers,
- TLSContextFactory* tlsContextFactory,
- TimerFactory* whitespacePingLayerFactory,
- XMLParserFactory* xmlParserFactory,
- EventLoop* eventLoop,
- const std::string& to,
- const URL& boshHTTPConnectProxyURL,
- const SafeString& boshHTTPConnectProxyAuthID,
- const SafeString& boshHTTPConnectProxyAuthPassword
+ const URL& boshURL,
+ PayloadParserFactoryCollection* payloadParserFactories,
+ PayloadSerializerCollection* payloadSerializers,
+ ConnectionFactory* connectionFactory,
+ TLSContextFactory* tlsContextFactory,
+ TimerFactory* whitespacePingLayerFactory,
+ XMLParserFactory* xmlParserFactory,
+ EventLoop* eventLoop,
+ const std::string& to,
+ const URL& boshHTTPConnectProxyURL,
+ const SafeString& boshHTTPConnectProxyAuthID,
+ const SafeString& boshHTTPConnectProxyAuthPassword
);
~BOSHSessionStream();