-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(low priority) core,netty,interop-testing: stabilize maxInboundMessageSize API #4399
Changes from 4 commits
8cd6dfd
6aadc05
381e536
e5b18cf
146d4ae
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,13 +293,12 @@ public T enableFullStreamDecompression() { | |
* <p>This method is advisory, and implementations may decide to not enforce this. Currently, | ||
* the only known transport to not enforce this is {@code InProcessTransport}. | ||
* | ||
* @param max the maximum number of bytes a single message can be. | ||
* @throws IllegalArgumentException if max is negative. | ||
* @param bytes the maximum number of bytes a single message can be. | ||
* @return this | ||
* @throws IllegalArgumentException if max is negative. | ||
* @since 1.1.0 | ||
*/ | ||
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2307") | ||
public T maxInboundMessageSize(int max) { | ||
public T maxInboundMessageSize(int bytes) { | ||
// intentional nop | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably should add in a checkArgument for bytes >= 0. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
return thisT(); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -203,6 +203,25 @@ public T handshakeTimeout(long timeout, TimeUnit unit) { | |
throw new UnsupportedOperationException(); | ||
} | ||
|
||
/** | ||
* Sets the maximum message size allowed to be received on the server. If not called, | ||
* defaults to 4 MiB. The default provides protection to servers who haven't considered the | ||
* possibility of receiving large messages while trying to be large enough to not be hit in normal | ||
* usage. | ||
* | ||
* <p>This method is advisory, and implementations may decide to not enforce this. Currently, | ||
* the only known transport to not enforce this is {@code InProcessServer}. | ||
* | ||
* @param bytes the maximum number of bytes a single message can be. | ||
* @return this | ||
* @throws IllegalArgumentException if max is negative. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/max/bytes/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
* @throws UnsupportedOperationException if unsupported. | ||
* @since 1.13.0 | ||
*/ | ||
public T maxInboundMessageSize(int bytes) { | ||
throw new UnsupportedOperationException(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Client-side doesn't throw. Since this is advisory, that seems the better approach? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed and added comment. |
||
} | ||
|
||
/** | ||
* Builds a server using the given parameters. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/max/bytes/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done