summaryrefslogtreecommitdiff
path: root/src/websockets/qwebsocket_p.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-11-21 16:12:56 +0100
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2014-11-21 16:12:56 +0100
commit44a5d30b863b536768afddf4792ebb93585a644a (patch)
treef41765eb1efbcf39bc5577affb8091eaa48898a5 /src/websockets/qwebsocket_p.cpp
parent06df2dac55dfac912b7eb1cbb6c29f2b0594ae10 (diff)
parent64927e04f202d33b9a9a1f94141ef692c0b513ac (diff)
downloadqtwebsockets-44a5d30b863b536768afddf4792ebb93585a644a.tar.gz
Merge remote-tracking branch 'origin/5.4' into dev
Change-Id: Ifc23e46ef1623cfba93571ff03c6c62a3b2fd117
Diffstat (limited to 'src/websockets/qwebsocket_p.cpp')
-rw-r--r--src/websockets/qwebsocket_p.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index ac743b6..7f5251b 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -385,12 +385,6 @@ void QWebSocketPrivate::open(const QUrl &url, bool mask)
m_pSocket->setPauseMode(m_pauseMode);
makeConnections(m_pSocket.data());
- QObject::connect(sslSocket, &QSslSocket::encryptedBytesWritten, q,
- &QWebSocket::bytesWritten);
- typedef void (QSslSocket:: *sslErrorSignalType)(const QList<QSslError> &);
- QObject::connect(sslSocket,
- static_cast<sslErrorSignalType>(&QSslSocket::sslErrors),
- q, &QWebSocket::sslErrors);
setSocketState(QAbstractSocket::ConnectingState);
sslSocket->setSslConfiguration(m_configuration.m_sslConfiguration);
@@ -419,8 +413,6 @@ void QWebSocketPrivate::open(const QUrl &url, bool mask)
m_pSocket->setPauseMode(m_pauseMode);
makeConnections(m_pSocket.data());
- QObject::connect(m_pSocket.data(), &QAbstractSocket::bytesWritten, q,
- &QWebSocket::bytesWritten);
setSocketState(QAbstractSocket::ConnectingState);
#ifndef QT_NO_NETWORKPROXY
m_pSocket->setProxy(m_configuration.m_proxy);
@@ -538,7 +530,7 @@ void QWebSocketPrivate::makeConnections(const QTcpSocket *pTcpSocket)
#ifndef QT_NO_NETWORKPROXY
QObject::connect(pTcpSocket, &QAbstractSocket::proxyAuthenticationRequired, q,
&QWebSocket::proxyAuthenticationRequired);
-#endif
+#endif // QT_NO_NETWORKPROXY
QObject::connect(pTcpSocket, &QAbstractSocket::readChannelFinished, q,
&QWebSocket::readChannelFinished);
QObject::connect(pTcpSocket, &QAbstractSocket::aboutToClose, q, &QWebSocket::aboutToClose);
@@ -551,6 +543,21 @@ void QWebSocketPrivate::makeConnections(const QTcpSocket *pTcpSocket)
//with QTcpSocket there is no problem, but with QSslSocket the processing hangs
QObjectPrivate::connect(pTcpSocket, &QAbstractSocket::readyRead, this,
&QWebSocketPrivate::processData, Qt::QueuedConnection);
+#ifndef QT_NO_SSL
+ const QSslSocket * const sslSocket = qobject_cast<const QSslSocket *>(pTcpSocket);
+ if (sslSocket) {
+ QObject::connect(sslSocket, &QSslSocket::encryptedBytesWritten, q,
+ &QWebSocket::bytesWritten);
+ typedef void (QSslSocket:: *sslErrorSignalType)(const QList<QSslError> &);
+ QObject::connect(sslSocket,
+ static_cast<sslErrorSignalType>(&QSslSocket::sslErrors),
+ q, &QWebSocket::sslErrors);
+ } else
+#endif // QT_NO_SSL
+ {
+ QObject::connect(pTcpSocket, &QAbstractSocket::bytesWritten, q,
+ &QWebSocket::bytesWritten);
+ }
}
QObject::connect(&m_dataProcessor, &QWebSocketDataProcessor::textFrameReceived, q,