QGrpcHttp2Channel: Prevent infinite error handling in error state

If the channel is in error state the socket could be non writable which
would result in an error loop if reconnections are steadily happening
since the logic would never reach m_reconnectFunction().

Add a safety check for the state to be Connected to protect against this
condition.

Pick-to: 6.9 6.8
Fixes: QTBUG-133937
Change-Id: Ie6c4858623ee8d7cc89a57d9bb14e4735fa64117
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Dennis Oberst 2025-02-19 18:33:27 +01:00
parent 84f39aacaf
commit 92520e45b8
1 changed files with 1 additions and 1 deletions

View File

@ -778,7 +778,7 @@ void QGrpcHttp2ChannelPrivate::processOperation(const std::shared_ptr<QGrpcOpera
Q_ASSERT_X(operationContextPtr != nullptr, "QGrpcHttp2ChannelPrivate::processOperation",
"operation context is nullptr.");
if (!m_socket->isWritable()) {
if (!m_socket->isWritable() && m_state == ConnectionState::Connected) {
operationContextAsyncError(operationContextPtr,
QGrpcStatus{ StatusCode::Unavailable,
m_socket->errorString() });