summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2014-09-06 13:07:37 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2014-09-11 19:31:51 +0200
commit66008040793f7e98f9cacd13271119b6b096d8bc (patch)
treec2ad6428a7e55a95a08274df94c26636667e4ce1 /src/network
parentd572ab1bb446e880fcb8d27294ba8149550f1659 (diff)
Remove incorrect read from QSslSocket::readData()
QIODevice makes readData() call only when its read buffer is empty. Also data argument points to the user or reserved read buffer area. So, no need in data transfer from read buffer at this point at all. Change-Id: Ieb4afdf7eec37fdf288073e4a060e64424f22b9c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/ssl/qsslsocket.cpp16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index d584c28e15..91d88e49f7 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1916,18 +1916,14 @@ qint64 QSslSocket::readData(char *data, qint64 maxlen)
if (d->mode == UnencryptedMode && !d->autoStartHandshake) {
readBytes = d->plainSocket->read(data, maxlen);
- } else {
- int bytesToRead = qMin<int>(maxlen, d->buffer.size());
- readBytes = d->buffer.read(data, bytesToRead);
- }
-
#ifdef QSSLSOCKET_DEBUG
- qDebug() << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") ==" << readBytes;
+ qDebug() << "QSslSocket::readData(" << (void *)data << ',' << maxlen << ") =="
+ << readBytes;
#endif
-
- // possibly trigger another transmit() to decrypt more data from the socket
- if (d->buffer.isEmpty() && d->plainSocket->bytesAvailable()) {
- QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection);
+ } else {
+ // possibly trigger another transmit() to decrypt more data from the socket
+ if (d->plainSocket->bytesAvailable())
+ QMetaObject::invokeMethod(this, "_q_flushReadBuffer", Qt::QueuedConnection);
}
return readBytes;