hyperium / h2

HTTP 2.0 client & server implementation for Rust.
MIT License
1.34k stars 269 forks source link

Add max send buffer per stream option #580

Closed seanmonstar closed 2 years ago

seanmonstar commented 2 years ago

An alternative to #577.

This makes the max send buffer size per stream, instead of for the entire connection. It also does a lot less to try to enforce it, since the assigning of capacity is a complicated beast. All this does is clamp how high something like SendStream::capacity() will return. It's more just an advisory to the user of the SendStream.

Since hyper currently will only produce more data once the available capacity is over zero, it should behave well with this change. I've tried out this patch in the hyper HTTP/2 benchmarks, and see that they all still pass (don't hang). However, this is missing some unit tests in flow_control.rs...