Add test that would make wait_for_capacity hang if it doesn't loop

This commit is contained in:
Anthony Ramine
2021-12-02 12:46:50 +01:00
committed by Sean McArthur
parent 87969c1f29
commit e9e0f27b80
2 changed files with 56 additions and 6 deletions

View File

@@ -54,14 +54,14 @@ impl Future for WaitForCapacity {
type Output = h2::SendStream<Bytes>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
let _ = ready!(self.stream().poll_capacity(cx)).unwrap();
loop {
let _ = ready!(self.stream().poll_capacity(cx)).unwrap();
let act = self.stream().capacity();
let act = self.stream().capacity();
if act >= self.target {
return Poll::Ready(self.stream.take().unwrap().into());
if act >= self.target {
return Poll::Ready(self.stream.take().unwrap().into());
}
}
Poll::Pending
}
}