summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslcontext_openssl.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-04-09 08:08:01 +0200
committerMarc Mutz <marc.mutz@kdab.com>2016-01-20 07:44:08 +0000
commita63a506d543430c22ce23107e1bdedeb489161b2 (patch)
tree753fc1087c2cf614feb62d89322d7b2a2aa3f0ac /src/network/ssl/qsslcontext_openssl.cpp
parentd6bb01e1779f1840dfbab57c6ecd615587bbde62 (diff)
QSslContext: provide sharedFromConfiguration()
It's a version of fromConfiguration() that returns the QSslContext instance in a shared instead of a naked pointer. Use it in QSslSocketBackend. The idea here, of course, is to use QSharedPointer<T>::create(), which co-locates the refcount with the payload in a single memory allocation, instead of QSharedPointer<T>(new T), which causes two allocations. Change-Id: Ia5396fb3b291f2912fca5cd97e0aa1e45e065e55 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network/ssl/qsslcontext_openssl.cpp')
-rw-r--r--src/network/ssl/qsslcontext_openssl.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp
index 05f2f8f769..b3786f989e 100644
--- a/src/network/ssl/qsslcontext_openssl.cpp
+++ b/src/network/ssl/qsslcontext_openssl.cpp
@@ -375,6 +375,13 @@ QSslContext* QSslContext::fromConfiguration(QSslSocket::SslMode mode, const QSsl
return sslContext;
}
+QSharedPointer<QSslContext> QSslContext::sharedFromConfiguration(QSslSocket::SslMode mode, const QSslConfiguration &configuration, bool allowRootCertOnDemandLoading)
+{
+ QSharedPointer<QSslContext> sslContext = QSharedPointer<QSslContext>::create();
+ initSslContext(sslContext.data(), mode, configuration, allowRootCertOnDemandLoading);
+ return sslContext;
+}
+
#if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_NEXTPROTONEG)
static int next_proto_cb(SSL *, unsigned char **out, unsigned char *outlen,