summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Session/BasicSessionStream.cpp')
-rw-r--r--Swiften/Session/BasicSessionStream.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 70bbeea..f50c5d5 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -1,18 +1,19 @@
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <Swiften/Session/BasicSessionStream.h>
#include <boost/bind.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <Swiften/StreamStack/XMPPLayer.h>
#include <Swiften/StreamStack/StreamStack.h>
#include <Swiften/StreamStack/ConnectionLayer.h>
#include <Swiften/StreamStack/WhitespacePingLayer.h>
#include <Swiften/StreamStack/CompressionLayer.h>
#include <Swiften/StreamStack/TLSLayer.h>
#include <Swiften/TLS/TLSContextFactory.h>
#include <Swiften/TLS/TLSContext.h>
@@ -104,19 +105,19 @@ bool BasicSessionStream::isOpen() {
bool BasicSessionStream::supportsTLSEncryption() {
return tlsContextFactory && tlsContextFactory->canCreate();
}
void BasicSessionStream::addTLSEncryption() {
assert(available);
tlsLayer = new TLSLayer(tlsContextFactory);
if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) {
- onClosed(boost::shared_ptr<Error>(new Error(Error::InvalidTLSCertificateError)));
+ onClosed(boost::make_shared<Error>(Error::InvalidTLSCertificateError));
}
else {
streamStack->addLayer(tlsLayer);
tlsLayer->onError.connect(boost::bind(&BasicSessionStream::handleTLSError, this));
tlsLayer->onConnected.connect(boost::bind(&BasicSessionStream::handleTLSConnected, this));
tlsLayer->connect();
}
}
@@ -166,37 +167,37 @@ void BasicSessionStream::handleStreamStartReceived(const ProtocolHeader& header)
onStreamStartReceived(header);
}
void BasicSessionStream::handleElementReceived(boost::shared_ptr<Element> element) {
onElementReceived(element);
}
void BasicSessionStream::handleXMPPError() {
available = false;
- onClosed(boost::shared_ptr<Error>(new Error(Error::ParseError)));
+ onClosed(boost::make_shared<Error>(Error::ParseError));
}
void BasicSessionStream::handleTLSConnected() {
onTLSEncrypted();
}
void BasicSessionStream::handleTLSError() {
available = false;
- onClosed(boost::shared_ptr<Error>(new Error(Error::TLSError)));
+ onClosed(boost::make_shared<Error>(Error::TLSError));
}
void BasicSessionStream::handleConnectionFinished(const boost::optional<Connection::Error>& error) {
available = false;
if (error == Connection::ReadError) {
- onClosed(boost::shared_ptr<Error>(new Error(Error::ConnectionReadError)));
+ onClosed(boost::make_shared<Error>(Error::ConnectionReadError));
}
else if (error) {
- onClosed(boost::shared_ptr<Error>(new Error(Error::ConnectionWriteError)));
+ onClosed(boost::make_shared<Error>(Error::ConnectionWriteError));
}
else {
onClosed(boost::shared_ptr<Error>());
}
}
void BasicSessionStream::handleDataRead(const SafeByteArray& data) {
onDataRead(data);
}