Commit 30b5e99d authored by Luca Niccoli's avatar Luca Niccoli Committed by Liang Qi
Browse files

Always initialize m_handshakeState


The client-side constructor was leaving it uninitialized, which would
sometimes lead to spurious error signals being emitted.

Task-number: QTBUG-44893
Change-Id: I7a17f1a16d9a5fe4218beb6d92993c1889ad836b
Reviewed-by: default avatarOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: default avatarLiang Qi <liang.qi@theqtcompany.com>
Showing with 4 additions and 1 deletion
...@@ -105,7 +105,8 @@ QWebSocketPrivate::QWebSocketPrivate(const QString &origin, QWebSocketProtocol:: ...@@ -105,7 +105,8 @@ QWebSocketPrivate::QWebSocketPrivate(const QString &origin, QWebSocketProtocol::
m_dataProcessor(), m_dataProcessor(),
m_configuration(), m_configuration(),
m_pMaskGenerator(&m_defaultMaskGenerator), m_pMaskGenerator(&m_defaultMaskGenerator),
m_defaultMaskGenerator() m_defaultMaskGenerator(),
m_handshakeState(NothingDoneState)
{ {
} }
......
...@@ -410,6 +410,7 @@ void tst_QWebSocket::tst_sendTextMessage() ...@@ -410,6 +410,7 @@ void tst_QWebSocket::tst_sendTextMessage()
QSignalSpy textFrameReceived(&socket, SIGNAL(textFrameReceived(QString,bool))); QSignalSpy textFrameReceived(&socket, SIGNAL(textFrameReceived(QString,bool)));
QSignalSpy binaryMessageReceived(&socket, SIGNAL(binaryMessageReceived(QByteArray))); QSignalSpy binaryMessageReceived(&socket, SIGNAL(binaryMessageReceived(QByteArray)));
QSignalSpy binaryFrameReceived(&socket, SIGNAL(binaryFrameReceived(QByteArray,bool))); QSignalSpy binaryFrameReceived(&socket, SIGNAL(binaryFrameReceived(QByteArray,bool)));
QSignalSpy socketError(&socket, SIGNAL(error(QAbstractSocket::SocketError)));
QUrl url = QUrl(QStringLiteral("ws://") + echoServer.hostAddress().toString() + QUrl url = QUrl(QStringLiteral("ws://") + echoServer.hostAddress().toString() +
QStringLiteral(":") + QString::number(echoServer.port())); QStringLiteral(":") + QString::number(echoServer.port()));
...@@ -419,6 +420,7 @@ void tst_QWebSocket::tst_sendTextMessage() ...@@ -419,6 +420,7 @@ void tst_QWebSocket::tst_sendTextMessage()
if (socketConnectedSpy.count() == 0) if (socketConnectedSpy.count() == 0)
QVERIFY(socketConnectedSpy.wait(500)); QVERIFY(socketConnectedSpy.wait(500));
QCOMPARE(socketError.count(), 0);
QCOMPARE(socket.state(), QAbstractSocket::ConnectedState); QCOMPARE(socket.state(), QAbstractSocket::ConnectedState);
socket.sendTextMessage(QStringLiteral("Hello world!")); socket.sendTextMessage(QStringLiteral("Hello world!"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment