Skip to content

Conversation

@erickpintor
Copy link
Collaborator

Previous code called StreamState::is_done inside StreamState::insert to check if the stream was complete. If so, it would transfer ownership of its inner parts to the returned ProposalParts, making subsequent calls to is_done return false.

The StreamState::is_done was also called after StreamState::insert by PartStreamsMap::insert to check if the stream was complete and remove it from the pending streams map. Since the second call to is_done after the stream is complete always returns false, the streams map was never pruned.

This patch modifies the ownership requirements of StreamState::insert so it takes ownership over the current stream state. If the stream is incomplete, it returns the ownership back. On completed streams, however, it consumes its inner components and return a ProposedParts.

This approach prevents future use of the stream state after its inner components have been transferred to the returned ProposedParts.

@erickpintor erickpintor requested a review from a team as a code owner January 19, 2026 13:55
@erickpintor erickpintor force-pushed the erick/fix-streams-map-pruning branch from 72fad53 to 170b65e Compare January 19, 2026 13:57
Previous code called `StreamState::is_done` inside `StreamState::insert`
to check if the stream was complete. If so, it would transfer ownership
of its inner parts to the returned `ProposalParts`, making subsequent
calls to `is_done` return `false`.

The `StreamState::is_done` was also called after `StreamState::insert`
by `PartStreamsMap::insert` to check if the stream was complete and
remove it from the pending streams map. Since the second call to
`is_done` after the stream is complete always returns `false`, the
streams map was never pruned.

This patch modifies the ownership requirements of `StreamState::insert`
so it takes ownership over the current stream state. If the stream is
incomplete, it returns the ownership back. On completed streams,
however, it consumes its inner components and return a `ProposedParts`.

This approach prevents future use of the stream state after its inner
components have been transferred to the returned `ProposedParts`.
@erickpintor erickpintor force-pushed the erick/fix-streams-map-pruning branch from 170b65e to e4cc848 Compare January 19, 2026 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants