quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.57k stars 363 forks source link

aggressive open_bi #1846

Closed szguoxz closed 1 month ago

szguoxz commented 1 month ago

Streams are cheap and instantaneous to open unless blocked by flow control. As a consequence, the peer won’t be notified that a stream has been opened until the stream is actually used.

This feature causes me a bug, and took me hours to figure out. The work around for me is to send a u8 when open_bi and read_u8 after accept_bi. If I don't do it, my accept_bi will got stuck.

Then I start to question of this design. Or, should we have an easy way to open an aggressive bi channel? So I don't have to do the write_u8, read_u8 hack?

Ralith commented 1 month ago

This is how QUIC works. The side which will first transmit on a stream should be the side responsible for opening it. This will be more prominently documented in the next release: https://github.com/quinn-rs/quinn/blob/0e9a19665a8afc26d3ad66a6f7e8b361960d235b/quinn/src/connection.rs#L317-L319 https://github.com/quinn-rs/quinn/blob/0e9a19665a8afc26d3ad66a6f7e8b361960d235b/quinn/src/recv_stream.rs#L31-L38