summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2017-05-08 20:07:37 +0300
committerTony Sarajärvi <tony.sarajarvi@qt.io>2017-08-27 06:17:52 +0000
commit5de734bc18dcf7cf660684c44b5fc6b886a7b88b (patch)
tree9d5b49fffb288b75a61bad4d18b5a3f921eee60b
parenteb93d7b51773b43e6a3e41961898a6033bcd9479 (diff)
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>
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 650d37fdbb..fbfeb00017 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -704,10 +704,9 @@ void QSslSocketBackendPrivate::transmit()
// Write encrypted data from the buffer into the read BIO.
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) {
- // ### TODO: make this cheaper by not making it memcpy. E.g. make it work with data=0x0 or make it work with seek
- plainSocket->read(data.data(), writtenToBio);
+ plainSocket->skip(writtenToBio);
} else {
// ### Better error handling.
setErrorAndEmit(QAbstractSocket::SslInternalError,