From f0e17783ae74427a7cdb454eefabe02a28376b5f Mon Sep 17 00:00:00 2001 From: "Mark D. Roth" Date: Thu, 19 Jan 2017 08:41:15 -0800 Subject: [PATCH] Add ChannelArguments methods for setting max send/recv message size. --- include/grpc++/support/channel_arguments.h | 4 ++++ src/cpp/common/channel_arguments.cc | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/include/grpc++/support/channel_arguments.h b/include/grpc++/support/channel_arguments.h index d43f7c61bdd..efdf7772ad7 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 1fdd1061303..65f32774999 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);