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 22c99cf498
Pick-to: 6.7
Change-Id: I973dfcf91541becc8c3d6363f9065bb1b9183062
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
parent
717dc9450f
commit
b0b2b7d39d
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue