diff options
author | Mårten Nordheim <marten.nordheim@qt.io> | 2020-05-13 12:14:21 +0200 |
---|---|---|
committer | Mårten Nordheim <marten.nordheim@qt.io> | 2020-05-15 15:44:22 +0200 |
commit | bd3b978701c32b2e13da853f2064aab369e32745 (patch) | |
tree | 722a184b72e5ab6e2f7f6c8862311759ad737a33 /src/network/access/qnetworkreplyimpl.cpp | |
parent | 035c16e9ff6cdc169dc6cf8ce94fc5c9e3769f7f (diff) |
QNetworkReply: Remove some bearer management leftovers
migrating backend was done if the QNetworkSession changed. With
QNetworkSession gone this was no longer called from anywhere.
Change-Id: I8c995001f9d4c7ae83446b4d29fa62c954c79889
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network/access/qnetworkreplyimpl.cpp')
-rw-r--r-- | src/network/access/qnetworkreplyimpl.cpp | 57 |
1 files changed, 2 insertions, 55 deletions
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index b0674823f7..b0f8fa1c7d 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -56,7 +56,7 @@ inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() copyDevice(nullptr), cacheEnabled(false), cacheSaveDevice(nullptr), notificationHandlingPaused(false), - bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), preMigrationDownloaded(-1), + bytesDownloaded(0), lastBytesDownloaded(-1), bytesUploaded(-1), httpStatusCode(0), state(Idle) , downloadBufferReadPosition(0) @@ -157,8 +157,6 @@ void QNetworkReplyImplPrivate::_q_copyReadyRead() lastBytesDownloaded = bytesDownloaded; QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (preMigrationDownloaded != Q_INT64_C(-1)) - totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); // emit readyRead before downloadProgress incase this will cause events to be // processed and we get into a recursive call (as in QProgressDialog). @@ -525,8 +523,6 @@ void QNetworkReplyImplPrivate::appendDownstreamDataSignalEmissions() Q_Q(QNetworkReplyImpl); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (preMigrationDownloaded != Q_INT64_C(-1)) - totalSize = totalSize.toLongLong() + preMigrationDownloaded; pauseNotificationHandling(); // important: At the point of this readyRead(), the data parameter list must be empty, // else implicit sharing will trigger memcpy when the user is reading data! @@ -653,13 +649,11 @@ void QNetworkReplyImplPrivate::finished() { Q_Q(QNetworkReplyImpl); - if (state == Finished || state == Aborted || state == WaitingForSession) + if (state == Finished || state == Aborted) return; pauseNotificationHandling(); QVariant totalSize = cookedHeaders.value(QNetworkRequest::ContentLengthHeader); - if (preMigrationDownloaded != Q_INT64_C(-1)) - totalSize = totalSize.toLongLong() + preMigrationDownloaded; resumeNotificationHandling(); @@ -787,8 +781,6 @@ void QNetworkReplyImpl::abort() // call finished which will emit signals d->error(OperationCanceledError, tr("Operation canceled")); - if (d->state == QNetworkReplyPrivate::WaitingForSession) - d->state = QNetworkReplyPrivate::Working; d->finished(); d->state = QNetworkReplyPrivate::Aborted; @@ -919,51 +911,6 @@ bool QNetworkReplyImpl::event(QEvent *e) return QObject::event(e); } -/* - Migrates the backend of the QNetworkReply to a new network connection if required. Returns - true if the reply is migrated or it is not required; otherwise returns \c false. -*/ -bool QNetworkReplyImplPrivate::migrateBackend() -{ - Q_Q(QNetworkReplyImpl); - - // Network reply is already finished or aborted, don't need to migrate. - if (state == Finished || state == Aborted) - return true; - - // Request has outgoing data, not migrating. - if (outgoingData) - return false; - - // Request is serviced from the cache, don't need to migrate. - if (copyDevice) - return true; - - // Backend does not support resuming download. - if (backend && !backend->canResume()) - return false; - - state = QNetworkReplyPrivate::Reconnecting; - - cookedHeaders.clear(); - rawHeaders.clear(); - - preMigrationDownloaded = bytesDownloaded; - - delete backend; - backend = manager->d_func()->findBackend(operation, request); - - if (backend) { - backend->setParent(q); - backend->reply = this; - backend->setResumeOffset(bytesDownloaded); - } - - QMetaObject::invokeMethod(q, "_q_startOperation", Qt::QueuedConnection); - - return true; -} - QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, QNetworkAccessManager::Operation op) |