aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/websockets/qwebsocket_p.cpp1
-rw-r--r--src/websockets/qwebsocket_p.h19
2 files changed, 18 insertions, 2 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 5a95215..aedc3c6 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -74,7 +74,6 @@ const quint64 DEFAULT_OUTGOING_FRAME_SIZE_IN_BYTES = 512 * 512 * 2; //default si
QWebSocketConfiguration::QWebSocketConfiguration() :
#ifndef QT_NO_SSL
- m_sslConfiguration(QSslConfiguration::defaultConfiguration()),
m_ignoredSslErrors(),
m_ignoreSslErrors(false),
#endif
diff --git a/src/websockets/qwebsocket_p.h b/src/websockets/qwebsocket_p.h
index ad667aa..c193a70 100644
--- a/src/websockets/qwebsocket_p.h
+++ b/src/websockets/qwebsocket_p.h
@@ -90,7 +90,24 @@ public:
public:
#ifndef QT_NO_SSL
- QSslConfiguration m_sslConfiguration;
+ struct TlsConfigurationLazy {
+ TlsConfigurationLazy &operator = (const QSslConfiguration &rhs)
+ {
+ tlsConfiguration.reset(new QSslConfiguration(rhs));
+ return *this;
+ }
+
+ operator QSslConfiguration() const
+ {
+ if (!tlsConfiguration.get())
+ tlsConfiguration.reset(new QSslConfiguration(QSslConfiguration::defaultConfiguration()));
+ return *tlsConfiguration.get();
+ }
+
+ mutable std::unique_ptr<QSslConfiguration> tlsConfiguration;
+ };
+
+ TlsConfigurationLazy m_sslConfiguration;
QList<QSslError> m_ignoredSslErrors;
bool m_ignoreSslErrors;
#endif