summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-11-12 18:12:47 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-11-12 18:12:47 (GMT)
commitfdd8755e2363e8d706a3d0bdc2e71f234abdf829 (patch)
tree470401f6f80873c4e1ce5af5cd30ab6837854d04 /Swiften/Session
parent6a20be61e229255f93d55f13be3346525698237a (diff)
downloadswift-contrib-fdd8755e2363e8d706a3d0bdc2e71f234abdf829.zip
swift-contrib-fdd8755e2363e8d706a3d0bdc2e71f234abdf829.tar.bz2
Refactored DNS handling.
Connections now fallback on other DNS entries upon failure, taking into account SRV priorities.
Diffstat (limited to 'Swiften/Session')
-rw-r--r--Swiften/Session/BasicSessionStream.cpp14
-rw-r--r--Swiften/Session/BasicSessionStream.h50
2 files changed, 32 insertions, 32 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index e0fbce7..a9a3cb0 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -20,13 +20,13 @@ void BasicSessionStream::initialize() {
xmppLayer->onStreamStart.connect(boost::bind(&BasicSessionStream::handleStreamStartReceived, shared_from_this(), _1));
xmppLayer->onElement.connect(boost::bind(&BasicSessionStream::handleElementReceived, shared_from_this(), _1));
xmppLayer->onError.connect(boost::bind(
- &BasicSessionStream::handleXMPPError, shared_from_this()));
- xmppLayer->onDataRead.connect(boost::bind(&BasicSessionStream::handleDataRead, shared_from_this(), _1));
- xmppLayer->onWriteData.connect(boost::bind(&BasicSessionStream::handleDataWritten, shared_from_this(), _1));
+ &BasicSessionStream::handleXMPPError, shared_from_this()));
+ xmppLayer->onDataRead.connect(boost::bind(&BasicSessionStream::handleDataRead, shared_from_this(), _1));
+ xmppLayer->onWriteData.connect(boost::bind(&BasicSessionStream::handleDataWritten, shared_from_this(), _1));
connection->onDisconnected.connect(boost::bind(&BasicSessionStream::handleConnectionError, shared_from_this(), _1));
connectionLayer = boost::shared_ptr<ConnectionLayer>(
- new ConnectionLayer(connection));
+ new ConnectionLayer(connection));
streamStack = new StreamStack(xmppLayer, connectionLayer);
@@ -34,7 +34,7 @@ void BasicSessionStream::initialize() {
}
BasicSessionStream::~BasicSessionStream() {
- delete streamStack;
+ delete streamStack;
}
void BasicSessionStream::writeHeader(const ProtocolHeader& header) {
@@ -57,7 +57,7 @@ bool BasicSessionStream::isAvailable() {
}
bool BasicSessionStream::supportsTLSEncryption() {
- return tlsLayerFactory && tlsLayerFactory->canCreate();
+ return tlsLayerFactory && tlsLayerFactory->canCreate();
}
void BasicSessionStream::addTLSEncryption() {
@@ -88,7 +88,7 @@ void BasicSessionStream::setWhitespacePingEnabled(bool enabled) {
}
void BasicSessionStream::resetXMPPParser() {
- xmppLayer->resetParser();
+ xmppLayer->resetParser();
}
void BasicSessionStream::handleStreamStartReceived(const ProtocolHeader& header) {
diff --git a/Swiften/Session/BasicSessionStream.h b/Swiften/Session/BasicSessionStream.h
index 0cb50eb..07bae81 100644
--- a/Swiften/Session/BasicSessionStream.h
+++ b/Swiften/Session/BasicSessionStream.h
@@ -7,26 +7,26 @@
#include "Swiften/Session/SessionStream.h"
namespace Swift {
- class TLSLayerFactory;
- class TLSLayer;
- class WhitespacePingLayer;
+ class TLSLayerFactory;
+ class TLSLayer;
+ class WhitespacePingLayer;
class PayloadParserFactoryCollection;
class PayloadSerializerCollection;
- class StreamStack;
+ class StreamStack;
class XMPPLayer;
- class ConnectionLayer;
+ class ConnectionLayer;
- class BasicSessionStream :
- public SessionStream,
- public boost::enable_shared_from_this<BasicSessionStream> {
- public:
- BasicSessionStream(
- boost::shared_ptr<Connection> connection,
- PayloadParserFactoryCollection* payloadParserFactories,
- PayloadSerializerCollection* payloadSerializers,
- TLSLayerFactory* tlsLayerFactory
- );
- ~BasicSessionStream();
+ class BasicSessionStream :
+ public SessionStream,
+ public boost::enable_shared_from_this<BasicSessionStream> {
+ public:
+ BasicSessionStream(
+ boost::shared_ptr<Connection> connection,
+ PayloadParserFactoryCollection* payloadParserFactories,
+ PayloadSerializerCollection* payloadSerializers,
+ TLSLayerFactory* tlsLayerFactory
+ );
+ ~BasicSessionStream();
void initialize();
@@ -43,17 +43,17 @@ namespace Swift {
virtual void resetXMPPParser();
- private:
+ private:
void handleConnectionError(const boost::optional<Connection::Error>& error);
- void handleXMPPError();
+ void handleXMPPError();
void handleTLSConnected();
- void handleTLSError();
+ void handleTLSError();
void handleStreamStartReceived(const ProtocolHeader&);
void handleElementReceived(boost::shared_ptr<Element>);
- void handleDataRead(const ByteArray& data);
- void handleDataWritten(const ByteArray& data);
+ void handleDataRead(const ByteArray& data);
+ void handleDataWritten(const ByteArray& data);
- private:
+ private:
bool available;
boost::shared_ptr<Connection> connection;
PayloadParserFactoryCollection* payloadParserFactories;
@@ -62,7 +62,7 @@ namespace Swift {
boost::shared_ptr<XMPPLayer> xmppLayer;
boost::shared_ptr<ConnectionLayer> connectionLayer;
StreamStack* streamStack;
- boost::shared_ptr<TLSLayer> tlsLayer;
- boost::shared_ptr<WhitespacePingLayer> whitespacePingLayer;
- };
+ boost::shared_ptr<TLSLayer> tlsLayer;
+ boost::shared_ptr<WhitespacePingLayer> whitespacePingLayer;
+ };
}