diff options
author | David Garcia Quintas <dgq@google.com> | 2016-05-18 20:25:57 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-05-18 20:25:57 -0700 |
commit | ac0944701ab93d6746f81a2a9ab38ee411e663d8 (patch) | |
tree | 95af27fc2cd5cb4f893d60ea8bc2aa2e1fe62498 /src/core/lib/channel | |
parent | ddefbb82270d97d8b87cac4959993ae61e204d1c (diff) | |
parent | 824f83758d80717f910c2cf973ff41fd98f8d81e (diff) |
Merge branch 'compression_incoming_checks' into compression_md_level_bis
Diffstat (limited to 'src/core/lib/channel')
-rw-r--r-- | src/core/lib/channel/channel_args.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index a171b41b35..c14b9aa422 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -35,6 +35,7 @@ #include <grpc/grpc.h> #include "src/core/lib/support/string.h" +#include <grpc/compression.h> #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> @@ -180,6 +181,7 @@ grpc_compression_algorithm grpc_channel_args_get_compression_algorithm( grpc_channel_args *grpc_channel_args_set_compression_algorithm( grpc_channel_args *a, grpc_compression_algorithm algorithm) { + GPR_ASSERT(algorithm < GRPC_COMPRESS_ALGORITHMS_COUNT); grpc_arg tmp; tmp.type = GRPC_ARG_INTEGER; tmp.key = GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM; @@ -214,7 +216,15 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( const int states_arg_found = find_compression_algorithm_states_bitset(*a, &states_arg); - if (states_arg_found) { + if (grpc_channel_args_get_compression_algorithm(*a) == algorithm && + state == 0) { + char *algo_name = NULL; + GPR_ASSERT(grpc_compression_algorithm_name(algorithm, &algo_name) != 0); + gpr_log(GPR_ERROR, + "Tried to disable default compression algorithm '%s'. The " + "operation has been ignored.", + algo_name); + } else if (states_arg_found) { if (state != 0) { GPR_BITSET((unsigned *)states_arg, algorithm); } else if (algorithm != GRPC_COMPRESS_NONE) { |