fix: set MAX_CONCURRENT_STREAMS
to usize::MAX
if no value is advertised initially
#736
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if the server provides no value as
MAX_CONCURRENT_STREAMS
in its initialSETTINGS
frame, the client keeps using the value set byh2::client::Builder::initial_max_send_streams
. However, given that the absence ofMAX_CONCURRENT_STREAMS
in the initialSETTINGS
frame implies that the server is willing to accept unlimited number of concurrent streams, it is more reasonable to overwrite the value set byh2::client::Builder::initial_max_send_streams
withusize::MAX
in this case.Note that this overwrite only happens when the server does not advertise
MAX_CONCURRENT_STREAMS
in its initialSETTINGS
frame. For second and laterSETTINGS
frames that do not includeMAX_CONCURRENT_STREAMS
, the client will not update the value and keep using the previously advertised value.This PR extracts some part from #732.
Related to #731.
Consideration
What value is set in this particular case varies among HTTP/2 implementations. For instance, Go uses 1,000 and nghttp2 uses infinity. I chose infinity tentatively, though it should work fine.