diff options
author | MÃ¥rten Nordheim <marten.nordheim@qt.io> | 2022-12-13 17:07:48 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-12-15 10:28:49 +0000 |
commit | 2fefb588392de5a3b09e1b35b2583cae4a66c698 (patch) | |
tree | f31fb19949bb752e294b83b81e12142b7fb73ff9 | |
parent | d26d05b028a7a5ba559f3b1d0918bb9afb9b3958 (diff) |
Disconnect when handshake fails
It is unexpected that websocket does not disconnect once
it knows the handshake has failed.
Change-Id: I11e64745ffdb01c11ac79739cf7f384ad6cc4590
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 7efdec16d9f6116fc6c13bc3ae7c9b9e229e5a49)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/websockets/qwebsocket_p.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp index 4be504e..8b18818 100644 --- a/src/websockets/qwebsocket_p.cpp +++ b/src/websockets/qwebsocket_p.cpp @@ -1090,6 +1090,8 @@ void QWebSocketPrivate::processHandshake(QTcpSocket *pSocket) // handshake failed setErrorString(errorDescription); emitErrorOccurred(QAbstractSocket::ConnectionRefusedError); + if (m_pSocket->state() != QAbstractSocket::UnconnectedState) + m_pSocket->disconnectFromHost(); } } |