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>
This commit is contained in:
Alex Trotsenko 2014-09-06 13:07:37 +03:00
parent d572ab1bb4
commit 6600804079

View File

@ -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;