Open DjordjeNikolasevic opened 2 weeks ago
If you're using h2 directly, you need to handle flow control explicitly. https://docs.rs/h2/latest/h2/#flow-control
@seanmonstar Is this really a problem with control flow? I am sending just few bytes of data.
I managed to solve the problem by adding stream.notify_push()
to Recv::recv_headers
, just below stream.notify_recv()
. It looks like the wake up for the poll_push_promise
is missing from some paths.
Though I am not sure if this is supposed to be the wanted behavior, or the caller should explicitly wait for the main response before iterating through push promises.
Oh, in this specific case, yea that could be.
(The flow control comment is still true, but perhaps not what you run into yet.)
I am trying to implement a basic server push scenario where the server makes multiple push requests. The client is first expected to process pushed requests and only then await for the main response. What I noticed is that when I simulate a delay on server side between sending push requests and the main response,
push_promise()
seems to be stuck on client side after receiving all of the promises. It looks like receiving the main response does not wake up the waiter.However, when I remove the delay or make the client firstly await for the main response, and only then call
push_promise()
, everything works fine.Firstly, my question is - Is server push in h2 expected to be used this way? I was not able to find any documentation about this or at least a basic usage example. If yes, is this a bug or I am misusing the library somewhere?
Code example:
Client:
Server: