quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

Fix duplicate MAX_STREAMS transmit #1439

Closed Ralith closed 1 year ago

Ralith commented 1 year ago

When the application observes a stream finish or reset, we dispose of its state via StreamsState::stream_freed, and queue a transmit of stream flow control credit directly on the Connection. stream_freed however also sets StreamsState::max_streams_dirty, which is polled each time we receive a packet to see whether a stream has become fully closed due to an incoming frame. Together, these led to a MAX_STREAMS frame being transmit both immediately, and following the next packet receipt. We prevent that by unsetting the appropriate max_streams_dirty flags when sending MAX_STREAMS.