diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-07-19 15:35:17 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-07-19 15:35:17 -0700 |
commit | b4e70366c6b25d1127e66fd28c6256b19467dd9b (patch) | |
tree | 7f51ee747a9ed1200899b1c3e19752d85ce878ed /src/cpp/server | |
parent | d82d0b295b51e1385481be381eef325423441a65 (diff) | |
parent | 0c2f1626c0082ab91aed27f77bbe01008d878db2 (diff) |
Merge branch 'decompression' of https://github.com/dgquintas/grpc into dgquintas-decompression
Conflicts:
Makefile
vsprojects/Grpc.mak
Diffstat (limited to 'src/cpp/server')
-rw-r--r-- | src/cpp/server/server_context.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 3b8a026996..bf7a4ba5ec 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -39,6 +39,7 @@ #include <grpc++/impl/sync.h> #include <grpc++/time.h> +#include "src/core/channel/compress_filter.h" #include "src/cpp/common/create_auth_context.h" namespace grpc { @@ -148,6 +149,24 @@ bool ServerContext::IsCancelled() const { return completion_op_ && completion_op_->CheckCancelled(cq_); } +void ServerContext::set_compression_level(grpc_compression_level level) { + const grpc_compression_algorithm algorithm_for_level = + grpc_compression_algorithm_for_level(level); + set_compression_algorithm(algorithm_for_level); +} + +void ServerContext::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); + AddInitialMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name); +} + void ServerContext::set_call(grpc_call* call) { call_ = call; auth_context_ = CreateAuthContext(call); |