Http2: fix some potential constness issues

The function is not const, and the access to the hash was
not const, so it would check if detaching was necessary.

Change-Id: Ie46cb89db20c8d9b227d50b4b6c5053dcb5791eb
Reviewed-by: Mate Barany <mate.barany@qt.io>
Reviewed-by: Dennis Oberst <dennis.oberst@qt.io>
(cherry picked from commit ca735d8d4113490c54671e6a99a89c2379ea68da)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mårten Nordheim 2024-06-28 12:42:45 +02:00 committed by Qt Cherry-pick Bot
parent 3be0f9e4ea
commit ece128fc5e

View File

@ -1136,8 +1136,8 @@ bool QHttp2Connection::readClientPreface()
void QHttp2Connection::handleConnectionClosure()
{
const auto errorString = QCoreApplication::translate("QHttp", "Connection closed");
for (auto it = m_streams.begin(), end = m_streams.end(); it != end; ++it) {
auto stream = it.value();
for (auto it = m_streams.cbegin(), end = m_streams.cend(); it != end; ++it) {
const QPointer<QHttp2Stream> &stream = it.value();
if (stream && stream->isActive())
stream->finishWithError(PROTOCOL_ERROR, errorString);
}
@ -1703,7 +1703,7 @@ void QHttp2Connection::handleWINDOW_UPDATE()
if (!valid || qAddOverflow(sessionSendWindowSize, qint32(delta), &sum))
return connectionError(PROTOCOL_ERROR, "WINDOW_UPDATE invalid delta");
sessionSendWindowSize = sum;
for (auto &stream : m_streams) {
for (const auto &stream : std::as_const(m_streams)) {
if (!stream || !stream->isActive())
continue;
// Stream may have been unblocked, so maybe try to write again