diff options
author | David Garcia Quintas <dgq@google.com> | 2016-05-16 19:12:12 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-05-16 22:06:54 -0700 |
commit | 9e9f7b62c706245cd74de1a7f01c03ba0bd96b0b (patch) | |
tree | f3e88e52aea27dbd0f8317b2a5f315beae411f7a /src/cpp/server | |
parent | effd74c3cc307c67059e30fa47359f9ca7d6d672 (diff) |
Refactorings and renamings related to compression.
Also added levels to the channel args options.
Diffstat (limited to 'src/cpp/server')
-rw-r--r-- | src/cpp/server/server_builder.cc | 7 | ||||
-rw-r--r-- | src/cpp/server/server_context.cc | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 61f0f6ae2a..e6050c3b52 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -125,6 +125,13 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() { } args.SetInt(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET, compression_options_.enabled_algorithms_bitset); + if (compression_options_.default_level.is_set) { + args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_LEVEL, + compression_options_.default_level.level); + } else if (compression_options_.default_algorithm.is_set) { + args.SetInt(GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM, + compression_options_.default_algorithm.algorithm); + } std::unique_ptr<Server> server( new Server(thread_pool.release(), true, max_message_size_, &args)); ServerInitializer* initializer = server->initializer(); diff --git a/src/cpp/server/server_context.cc b/src/cpp/server/server_context.cc index 204fef1b09..43117fd1e9 100644 --- a/src/cpp/server/server_context.cc +++ b/src/cpp/server/server_context.cc @@ -42,7 +42,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include "src/core/lib/channel/compress_filter.h" #include "src/core/lib/surface/call.h" namespace grpc { @@ -196,6 +195,9 @@ bool ServerContext::IsCancelled() const { } void ServerContext::set_compression_level(grpc_compression_level level) { + // TODO(dgq): get rid of grpc_call_compression_for_level and propagate the + // compression level by adding a new argument to + // CallOpSendInitialMetadata::SendInitialMetadata. const grpc_compression_algorithm algorithm_for_level = grpc_call_compression_for_level(call_, level); set_compression_algorithm(algorithm_for_level); @@ -210,7 +212,7 @@ void ServerContext::set_compression_algorithm( abort(); } GPR_ASSERT(algorithm_name != NULL); - AddInitialMetadata(GRPC_COMPRESS_REQUEST_ALGORITHM_KEY, algorithm_name); + AddInitialMetadata(GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY, algorithm_name); } grpc::string ServerContext::peer() const { |