summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2018-07-28 11:45:35 (GMT)
committerTobias Markmann <tm@ayena.de>2018-07-30 13:27:15 (GMT)
commit798f8ec3331043a92f6ca3bc810b9477c3f8261e (patch)
tree868bde2ddcbad1a66d4256edd6050f486860eb2b /Swiften/Session/BasicSessionStream.cpp
parent48596613cfe0f45c0916beabbcc3a27e01752c4b (diff)
downloadswift-798f8ec3331043a92f6ca3bc810b9477c3f8261e.zip
swift-798f8ec3331043a92f6ca3bc810b9477c3f8261e.tar.bz2
Use std::unique_ptr to have TLS classes own the TLSContext
TLSLayer and TLSConnection now own the TLSContext they use. The TLSContextFactory interface is adjusted to use std::unique_ptr. Test-Information: Builds and all tests pass on macOS with clang-7-master. Change-Id: I14e33c98b48445094f404b73ea41af0a51d2dde6
Diffstat (limited to 'Swiften/Session/BasicSessionStream.cpp')
-rw-r--r--Swiften/Session/BasicSessionStream.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Swiften/Session/BasicSessionStream.cpp b/Swiften/Session/BasicSessionStream.cpp
index 10c6ad0..54cd225 100644
--- a/Swiften/Session/BasicSessionStream.cpp
+++ b/Swiften/Session/BasicSessionStream.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -111,7 +111,8 @@ bool BasicSessionStream::supportsTLSEncryption() {
void BasicSessionStream::addTLSEncryption() {
assert(available);
- tlsLayer = new TLSLayer(tlsContextFactory, tlsOptions_);
+ auto tlsContext = tlsContextFactory->createTLSContext(tlsOptions_);
+ tlsLayer = new TLSLayer(std::move(tlsContext));
if (hasTLSCertificate() && !tlsLayer->setClientCertificate(getTLSCertificate())) {
onClosed(std::make_shared<SessionStreamError>(SessionStreamError::InvalidTLSCertificateError));
}