aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/client/client_context.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpp/client/client_context.cc')
-rw-r--r--src/cpp/client/client_context.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc
index 372f3e27ec..69216d2030 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -34,8 +34,11 @@
#include <grpc++/client_context.h>
#include <grpc/grpc.h>
+#include <grpc/support/string_util.h>
#include <grpc++/credentials.h>
#include <grpc++/time.h>
+
+#include "src/core/channel/compress_filter.h"
#include "src/cpp/common/create_auth_context.h"
namespace grpc {
@@ -76,6 +79,18 @@ void ClientContext::set_call(grpc_call* call,
}
}
+void ClientContext::_experimental_set_compression_algorithm(
+ grpc_compression_algorithm algorithm) {
+ char* algorithm_name = NULL;
+ if (!grpc_compression_algorithm_name(algorithm, &algorithm_name)) {
+ gpr_log(GPR_ERROR, "Name for compression algorithm '%d' unknown.",
+ algorithm);
+ abort();
+ }
+ GPR_ASSERT(algorithm_name != NULL);
+ AddMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name);
+}
+
std::shared_ptr<const AuthContext> ClientContext::auth_context() const {
if (auth_context_.get() == nullptr) {
auth_context_ = CreateAuthContext(call_);