OkHttpServer: support maxConcurrentCallsPerConnection (Fixes #11062).#11063
Merged
Conversation
a42b7bd to
553f169
Compare
…). * Add option in OkHttpServerBuilder * Add value as MAX_CONCURRENT_STREAM setting in settings frame sent by the server to the client per connection * Enforce limit by sending a RST frame with REFUSED_STREAM error
553f169 to
bbd84b2
Compare
ejona86
approved these changes
Apr 1, 2024
| if (newStream) { | ||
| lastStreamId = streamId; | ||
| if (config.maxConcurrentStreams <= streams.size()) { | ||
| streamError(streamId, ErrorCode.REFUSED_STREAM, |
Member
There was a problem hiding this comment.
PROTOCOL_ERROR would handle implementation bugs better, because the streams wouldn't be retried. But there is a handshake race for new connections where the client may initially exceed the stream limit. REFUSED_STREAM is most helpful if the stream limit is changing over the life of the connection. To make this "really nice" we could set a flag in ackSettings() and do receivedSettingsAck ? ErrorCode.PROTOCOL_ERROR : ErrorCode.REFUSED_STREAM, because there's no valid reason for the client to exceed the stream limit after acking the settings.
But what you have is fine, and that'd be more annoying for you to test.
temawi
approved these changes
Apr 1, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This PR is really a try since I may be not enough familiar with all gRPC internals. Let me know if I'm too far from a correct solution.