Http2: Always return an error on error
Instead of returning a nullptr in a potential OOM case. Change-Id: Ib438eaa7550d193cb1207a5d3e48a78b882fa56e Reviewed-by: Matthias Rauter <matthias.rauter@qt.io> (cherry picked from commit 238f656d613fc100a8d17ccc980843b39c0056eb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
f60bef8768
commit
ad883b78ac
@ -859,8 +859,13 @@ QHttp2Connection::createStreamInternal()
|
||||
const quint32 streamID = m_nextStreamID;
|
||||
if (size_t(m_maxConcurrentStreams) <= size_t(numActiveLocalStreams()))
|
||||
return { QHttp2Connection::CreateStreamError::MaxConcurrentStreamsReached };
|
||||
m_nextStreamID += 2;
|
||||
return { createStreamInternal_impl(streamID) };
|
||||
|
||||
if (QHttp2Stream *ptr = createStreamInternal_impl(streamID)) {
|
||||
m_nextStreamID += 2;
|
||||
return {ptr};
|
||||
}
|
||||
// Connection could be broken, we could've ran out of memory, we don't know
|
||||
return { QHttp2Connection::CreateStreamError::UnknownError };
|
||||
}
|
||||
|
||||
QHttp2Stream *QHttp2Connection::createStreamInternal_impl(quint32 streamID)
|
||||
|
@ -212,6 +212,7 @@ public:
|
||||
MaxConcurrentStreamsReached,
|
||||
StreamIdsExhausted,
|
||||
ReceivedGOAWAY,
|
||||
UnknownError,
|
||||
};
|
||||
Q_ENUM(CreateStreamError)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user