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 Change-Id: I973dfcf91541becc8c3d6363f9065bb1b9183062 Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit b0b2b7d39d9689dfdcb69394d2c1b3a3e20f9999) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
50af22aa8d
commit
fb5ff98d32
@ -325,11 +325,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…
x
Reference in New Issue
Block a user