From 5e969e8646e2fdd86a98c143f105486977dae9ad Mon Sep 17 00:00:00 2001 From: Dennis Oberst Date: Wed, 23 Jul 2025 11:57:19 +0200 Subject: [PATCH] QGrpcHttp2Channel: Remove unneeded check when creating stream The `m_connection` check was not needed as there are two places where this is called: - inside createHttp2Connection() -> connection gets created, 100% valid - inside processOperation(), where we need the m_connection check anyways. Remove the check + error and replace it with an assert. Pick-to: 6.10 6.9 6.8 Change-Id: Ib1d8a16db65cadfecb242f54a27ab70bb08a78fd Reviewed-by: Alexey Edelev --- src/grpc/qgrpchttp2channel.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/grpc/qgrpchttp2channel.cpp b/src/grpc/qgrpchttp2channel.cpp index 6f6e6e38..b0cf2040 100644 --- a/src/grpc/qgrpchttp2channel.cpp +++ b/src/grpc/qgrpchttp2channel.cpp @@ -1124,15 +1124,9 @@ void QGrpcHttp2ChannelPrivate::ensureSchemeIsValid(QLatin1String expected) bool QGrpcHttp2ChannelPrivate::createHttp2Stream(Http2Handler *handler) { Q_ASSERT(handler != nullptr); + Q_ASSERT(m_connection); auto *channelOpPtr = handler->operation(); - if (!m_connection) { - operationContextAsyncError(channelOpPtr, - QGrpcStatus{ StatusCode::Unavailable, - tr("Unable to establish an HTTP/2 connection") }); - return false; - } - const auto streamAttempt = m_connection->createStream(); if (!streamAttempt.ok()) { operationContextAsyncError(channelOpPtr,