summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOleksandr Tymoshenko <gonzo@bluezbox.com>2016-05-19 11:34:05 -0700
committerOleksandr Tymoshenko <gonzo@bluezbox.com>2016-06-20 21:28:10 +0000
commite66dcd51d0e5517e88cd59912fd08501522a2902 (patch)
tree005490ee60e4bbebeafc493c45c67e511393dd7f /src
parent04f50e048ff907885ac648782ef293d7aef66ace (diff)
downloadqtwebsockets-e66dcd51d0e5517e88cd59912fd08501522a2902.tar.gz
Fixed erroneous detection of server disconnect condition
QAbstractSocket::atEnd does not check actual connection state it only checks if data is ready to be read. Under some conditions (e.g. slow network) data may not be available yet but it doesn't mean the server dropped connection. When more data comes FSM will pick it up and handle as expected. The right way to check disconnect is to check for actual socket state. Task-number: QTBUG-51069 Change-Id: I17d7110fbefdba2d5378a71935ab5923f8c1bf3e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/websockets/qwebsocket_p.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/websockets/qwebsocket_p.cpp b/src/websockets/qwebsocket_p.cpp
index 2fd52fe..3df969e 100644
--- a/src/websockets/qwebsocket_p.cpp
+++ b/src/websockets/qwebsocket_p.cpp
@@ -975,7 +975,7 @@ void QWebSocketPrivate::processHandshake(QTcpSocket *pSocket)
}
if (m_handshakeState != ParsingHeaderState) {
- if (pSocket->atEnd()) {
+ if (pSocket->state() != QAbstractSocket::ConnectedState) {
errorDescription = QWebSocket::tr("QWebSocketPrivate::processHandshake: Connection closed while reading header.");
break;
}