Skip to content

Commit

Permalink
h2: poll ready before using (istio#997)
Browse files Browse the repository at this point in the history
This is "required" per the docs. I don't think it really is, but good to
be safe and follow the docs

(cherry picked from commit faa4f23)
  • Loading branch information
howardjohn committed May 2, 2024
1 parent cfa1142 commit 2f1beb7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/proxy/h2_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ impl H2ConnectClient {
&mut self,
req: Request<()>,
) -> Result<(SendStream<SendBuf>, h2::RecvStream), Error> {
// "This function must return `Ready` before `send_request` is called"
// We should always be ready though, because we make sure we don't go over the max stream limit out of band.
futures::future::poll_fn(|cx| self.sender.poll_ready(cx)).await?;
let (response, stream) = self.sender.send_request(req, false)?;
let response = response.await?;
if response.status() != 200 {
Expand Down

0 comments on commit 2f1beb7

Please sign in to comment.