Refactor QuicSession::MaybeProcessPendingStream() to return a bool to indicate whether to continue processing the next pending stream or not. PiperOrigin-RevId: 589132325
diff --git a/quiche/quic/core/quic_session.cc b/quiche/quic/core/quic_session.cc index 4a805aa..c59605e 100644 --- a/quiche/quic/core/quic_session.cc +++ b/quiche/quic/core/quic_session.cc
@@ -184,7 +184,7 @@ return pending; } -void QuicSession::MaybeProcessPendingStream(PendingStream* pending) { +bool QuicSession::MaybeProcessPendingStream(PendingStream* pending) { QUICHE_DCHECK(pending != nullptr); QuicStreamId stream_id = pending->id(); std::optional<QuicResetStreamError> stop_sending_error_code = @@ -198,11 +198,11 @@ if (stop_sending_error_code) { stream->OnStopSending(*stop_sending_error_code); if (!connection()->connected()) { - return; + return false; } } stream->OnStreamCreatedFromPendingStream(); - return; + return connection()->connected(); } // At this point, none of the bytes has been successfully consumed by the // application layer. We should close the pending stream even if it is @@ -211,6 +211,7 @@ if (pending->sequencer()->IsClosed()) { ClosePendingStream(stream_id); } + return connection()->connected(); } void QuicSession::PendingStreamOnWindowUpdateFrame( @@ -2714,8 +2715,7 @@ pending_streams.push_back(it->second.get()); } for (auto* pending_stream : pending_streams) { - MaybeProcessPendingStream(pending_stream); - if (!connection()->connected()) { + if (!MaybeProcessPendingStream(pending_stream)) { return; } }
diff --git a/quiche/quic/core/quic_session.h b/quiche/quic/core/quic_session.h index ef309c0..af86bbe 100644 --- a/quiche/quic/core/quic_session.h +++ b/quiche/quic/core/quic_session.h
@@ -918,7 +918,9 @@ QuicStreamId id) const; // Process the pending stream if possible. - void MaybeProcessPendingStream(PendingStream* pending); + // Returns true if more pending streams should be processed afterwards while + // iterating through all pending streams. + bool MaybeProcessPendingStream(PendingStream* pending); // Creates or gets pending stream, feeds it with |frame|, and returns the // pending stream. Can return NULL, e.g., if the stream ID is invalid.