QHttpConnection: Create new streams returns error when ids are exhausted

CreateStream returns a new error code, StreamIdsExhausted, when next
stream id counter exceeds max stream id instead of assert.

Task-number: QTBUG-122375
Change-Id: I653b20c24c1429fe88d476beb1ca952aa1bbb320
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
(cherry picked from commit 9b386127a091ff12229709b4a60ad6d4e8b05512)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Øystein Heskestad 2024-03-14 14:58:18 +01:00 committed by Qt Cherry-pick Bot
parent 5b3fd5e9d2
commit b71a4b9a2f
2 changed files with 3 additions and 1 deletions

View File

@ -540,8 +540,9 @@ QHttp2Connection *QHttp2Connection::createDirectServerConnection(QIODevice *sock
QH2Expected<QHttp2Stream *, QHttp2Connection::CreateStreamError> QHttp2Connection::createStream()
{
Q_ASSERT(m_nextStreamID <= lastValidStreamID);
Q_ASSERT(m_connectionType == Type::Client); // This overload is just for clients
if (m_nextStreamID > lastValidStreamID)
return { QHttp2Connection::CreateStreamError::StreamIdsExhausted };
return createStreamInternal();
}

View File

@ -193,6 +193,7 @@ class Q_NETWORK_EXPORT QHttp2Connection : public QObject
public:
enum class CreateStreamError {
MaxConcurrentStreamsReached,
StreamIdsExhausted,
ReceivedGOAWAY,
};
Q_ENUM(CreateStreamError)