diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2020-08-06 18:57:43 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2020-08-11 17:21:45 +0300 |
commit | 8f53d66e3e412911f4648e88e3e753043fcbfad8 (patch) | |
tree | a14e015a4517f0d99a137cbf3e1ad0106ce665ed /src/network/ssl/qsslsocket.cpp | |
parent | a99cee1c7b095a552c04c2aa832574a6f0f44720 (diff) |
Introduce QIODevice::skipData()
QIODevice::skip() called a virtual QIODevicePrivate::skip() to
implement an efficient skipping on I/O devices for the internal
subclasses. The user subclasses cannot inherit QIODevicePrivate, so
this functionality was not externally accessible.
This patch replaces QIODevicePrivate::skip() with a virtual protected
QIODevice::skipData(). While the basic implementation simply discards
the data by reading into a dummy buffer, users can reimplement this
function to improve the performance in their subclasses.
[ChangeLog][QtCore][QIODevice] Added virtual protected skipData().
Now, subclasses can implement device-specific skipping of data.
Change-Id: I9522f7f7ab9d03ac06e972a525f8ec2fa909a617
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/network/ssl/qsslsocket.cpp')
-rw-r--r-- | src/network/ssl/qsslsocket.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 66bcb79c4c..19ab903d36 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -2541,17 +2541,19 @@ QByteArray QSslSocketPrivate::peek(qint64 maxSize) } /*! - \internal + \reimp */ -qint64 QSslSocketPrivate::skip(qint64 maxSize) +qint64 QSslSocket::skipData(qint64 maxSize) { - if (mode == QSslSocket::UnencryptedMode && !autoStartHandshake) - return plainSocket->skip(maxSize); + Q_D(QSslSocket); + + if (d->mode == QSslSocket::UnencryptedMode && !d->autoStartHandshake) + return d->plainSocket->skip(maxSize); // In encrypted mode, the SSL backend writes decrypted data directly into the // QIODevice's read buffer. As this buffer is always emptied by the caller, // we need to wait for more incoming data. - return (state == QAbstractSocket::ConnectedState) ? Q_INT64_C(0) : Q_INT64_C(-1); + return (d->state == QAbstractSocket::ConnectedState) ? Q_INT64_C(0) : Q_INT64_C(-1); } /*! |