summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qabstractsocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/socket/qabstractsocket.cpp')
-rw-r--r--src/network/socket/qabstractsocket.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index e223358..2a942cc 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -2201,6 +2201,8 @@ qint64 QAbstractSocket::readData(char *data, qint64 maxSize)
return -1; // no socket engine is probably EOF
if (!d->socketEngine->isValid())
return -1; // This is for unbuffered TCP when we already had been disconnected
+ if (d->state != QAbstractSocket::ConnectedState)
+ return -1; // This is for unbuffered TCP if we're not connected yet
qint64 readBytes = d->socketEngine->read(data, maxSize);
if (readBytes == -2) {
// -2 from the engine means no bytes available (EAGAIN) so read more later