summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2017-05-27 00:54:56 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2017-06-08 04:00:54 +0000
commitf78a189da5d9e13a96a52b9d17cdc80df06ed8c8 (patch)
tree58001f219d2b107d8557cff4f84ce0074213b6e2 /src/network
parent678ff94ff29db1b0faa4aa8d486d4df544ce3247 (diff)
QSSLSocket::readData return -1 when socket is not connected
As QAbstractSocket::readData does and as the documentation of QIODevice says "this function returns -1 in those cases (that is, reading on a closed socket..." Change-Id: I1e64673f6a6d792a640bd6cb28b2bb5a0f18dc36 Reviewed-by: Aleix Pol Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/ssl/qsslsocket.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 84b8f3a8d9..0e4b049353 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1993,6 +1993,8 @@ qint64 QSslSocket::readData(char *data, qint64 maxlen)
// possibly trigger another transmit() to decrypt more data from the socket
if (d->plainSocket->bytesAvailable())
QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection);
+ else if (d->state != QAbstractSocket::ConnectedState)
+ return maxlen ? qint64(-1) : qint64(0);
}
return readBytes;