aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mark D. Roth <roth@google.com>2017-01-19 08:41:15 -0800
committerGravatar Mark D. Roth <roth@google.com>2017-01-19 08:41:15 -0800
commitf0e17783ae74427a7cdb454eefabe02a28376b5f (patch)
treed5bd49aa70c1bfadbbc47b0e84cd1bd4ffd338c9
parent73b20e6f942ebf2a5f4703a82e7a3edd6d01f607 (diff)
Add ChannelArguments methods for setting max send/recv message size.
-rw-r--r--include/grpc++/support/channel_arguments.h4
-rw-r--r--src/cpp/common/channel_arguments.cc8
2 files changed, 12 insertions, 0 deletions
diff --git a/include/grpc++/support/channel_arguments.h b/include/grpc++/support/channel_arguments.h
index d43f7c61bd..efdf7772ad 100644
--- a/include/grpc++/support/channel_arguments.h
+++ b/include/grpc++/support/channel_arguments.h
@@ -88,6 +88,10 @@ class ChannelArguments {
/// The given buffer pool will be attached to the constructed channel
void SetResourceQuota(const ResourceQuota& resource_quota);
+ /// Sets the max receive and send message sizes.
+ void SetMaxReceiveMessageSize(int size);
+ void SetMaxSendMessageSize(int size);
+
/// Set LB policy name.
/// Note that if the name resolver returns only balancer addresses, the
/// grpclb LB policy will be used, regardless of what is specified here.
diff --git a/src/cpp/common/channel_arguments.cc b/src/cpp/common/channel_arguments.cc
index 1fdd106130..65f3277499 100644
--- a/src/cpp/common/channel_arguments.cc
+++ b/src/cpp/common/channel_arguments.cc
@@ -143,6 +143,14 @@ void ChannelArguments::SetResourceQuota(
grpc_resource_quota_arg_vtable());
}
+void ChannelArguments::SetMaxReceiveMessageSize(int size) {
+ SetInt(GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH, size);
+}
+
+void ChannelArguments::SetMaxSendMessageSize(int size) {
+ SetInt(GRPC_ARG_MAX_SEND_MESSAGE_LENGTH, size);
+}
+
void ChannelArguments::SetLoadBalancingPolicyName(
const grpc::string& lb_policy_name) {
SetString(GRPC_ARG_LB_POLICY_NAME, lb_policy_name);