summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2024-03-15 12:34:36 +0100
committerMårten Nordheim <marten.nordheim@qt.io>2024-03-18 17:42:19 +0100
commitb0b2b7d39d9689dfdcb69394d2c1b3a3e20f9999 (patch)
treeec265789359df70722fb3670176ff46a5d7c517e /src/network
parent717dc9450ffc13ef8209a10073552ac4574a4160 (diff)
Http2: fix streamsToUse logic
The settings frame with the max streams might be received late or be revised later, so we cannot assert something on the relation with the max streams allowed. Amends 22c99cf498103c86baa5a415ca34630396e5b6aa Pick-to: 6.7 Change-Id: I973dfcf91541becc8c3d6363f9065bb1b9183062 Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
index 6388044094..b2b3676fd7 100644
--- a/src/network/access/qhttp2protocolhandler.cpp
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -326,11 +326,10 @@ bool QHttp2ProtocolHandler::sendRequest()
initReplyFromPushPromise(message, key);
}
- Q_ASSERT(qint64(maxConcurrentStreams) >= activeStreams.size());
- const size_t streamsToUse = std::min(maxConcurrentStreams - size_t(activeStreams.size()),
- size_t(requests.size()));
+ const qint64 streamsToUse = qBound(0, qint64(maxConcurrentStreams) - activeStreams.size(),
+ requests.size());
auto it = requests.begin();
- for (size_t i = 0; i < streamsToUse; ++i) {
+ for (qint64 i = 0; i < streamsToUse; ++i) {
const qint32 newStreamID = createNewStream(*it);
if (!newStreamID) {
// TODO: actually we have to open a new connection.