Remove uneffective code when handling reply

Calling `handleAdditionalRequestCanceled();` when `handleAborting`
is true is useless because then also `m_abortingAllRequests` is true
and therefore `handleAdditionalRequestCanceled();` always returns
early doing nothing.
This commit is contained in:
Martchus 2023-04-15 22:02:43 +02:00
parent d510b34abb
commit 8c74b24045
1 changed files with 2 additions and 7 deletions

View File

@ -184,11 +184,9 @@ void SyncthingConnection::handleSslErrors(const QList<QSslError> &errors)
SyncthingConnection::Reply SyncthingConnection::handleReply(QNetworkReply *reply, bool readData, bool handleAborting)
{
const auto log = m_loggingFlags & SyncthingConnectionLoggingFlags::ApiReplies;
readData = (readData || log) && reply->isOpen();
handleAborting = handleAborting && m_abortingAllRequests;
const auto data = Reply{
.reply = handleAborting ? nullptr : reply, // skip further processing if aborting to reconnect
.response = readData ? reply->readAll() : QByteArray(),
.reply = (handleAborting && m_abortingAllRequests) ? nullptr : reply, // skip further processing if aborting to reconnect
.response = ((readData || log) && reply->isOpen()) ? reply->readAll() : QByteArray(),
};
reply->deleteLater();
@ -203,9 +201,6 @@ SyncthingConnection::Reply SyncthingConnection::handleReply(QNetworkReply *reply
cerr << std::string_view(data.response.data(), static_cast<std::string_view::size_type>(data.response.size()));
}
}
if (handleAborting) {
handleAdditionalRequestCanceled();
}
return data;
}