Fix some flow control bugs. (#152)
* Release stream capacity back to the connection to avoid capacity leaks. * Actually notify waiting tasks when capacity becomes available.
This commit is contained in:
@@ -68,6 +68,10 @@ pub fn settings() -> Mock<frame::Settings> {
|
||||
Mock(frame::Settings::default())
|
||||
}
|
||||
|
||||
pub fn settings_ack() -> Mock<frame::Settings> {
|
||||
Mock(frame::Settings::ack())
|
||||
}
|
||||
|
||||
pub fn ping(payload: [u8; 8]) -> Mock<frame::Ping> {
|
||||
Mock(frame::Ping::new(payload))
|
||||
}
|
||||
@@ -269,6 +273,11 @@ impl Mock<frame::Settings> {
|
||||
self.0.set_max_concurrent_streams(Some(max));
|
||||
self
|
||||
}
|
||||
|
||||
pub fn initial_window_size(mut self, val: u32) -> Self {
|
||||
self.0.set_initial_window_size(Some(val));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Mock<frame::Settings>> for frame::Settings {
|
||||
|
||||
@@ -35,8 +35,6 @@ impl Future for WaitForCapacity {
|
||||
|
||||
let act = self.stream().capacity();
|
||||
|
||||
println!("CAP={:?}", act);
|
||||
|
||||
if act >= self.target {
|
||||
return Ok(self.stream.take().unwrap().into());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user