QSslSocketBackendPrivate::transmit(): improve writing to OpenSSL
This patch avoids intermediate copying of the data by using a new QIODevice::skip() API. Change-Id: I358a83b21e2a58b59481745162fce1894549c0ac Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Markus Goetz (Woboq GmbH) <markus@woboq.com>
This commit is contained in:
parent
eb93d7b517
commit
5de734bc18
@ -704,10 +704,9 @@ void QSslSocketBackendPrivate::transmit()
|
|||||||
// Write encrypted data from the buffer into the read BIO.
|
// Write encrypted data from the buffer into the read BIO.
|
||||||
int writtenToBio = q_BIO_write(readBio, data.constData(), encryptedBytesRead);
|
int writtenToBio = q_BIO_write(readBio, data.constData(), encryptedBytesRead);
|
||||||
|
|
||||||
// do the actual read() here and throw away the results.
|
// Throw away the results.
|
||||||
if (writtenToBio > 0) {
|
if (writtenToBio > 0) {
|
||||||
// ### TODO: make this cheaper by not making it memcpy. E.g. make it work with data=0x0 or make it work with seek
|
plainSocket->skip(writtenToBio);
|
||||||
plainSocket->read(data.data(), writtenToBio);
|
|
||||||
} else {
|
} else {
|
||||||
// ### Better error handling.
|
// ### Better error handling.
|
||||||
setErrorAndEmit(QAbstractSocket::SslInternalError,
|
setErrorAndEmit(QAbstractSocket::SslInternalError,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user