diff options
author | David Garcia Quintas <dgq@google.com> | 2016-05-18 17:15:11 -0700 |
---|---|---|
committer | David Garcia Quintas <dgq@google.com> | 2016-05-18 17:15:11 -0700 |
commit | ddefbb82270d97d8b87cac4959993ae61e204d1c (patch) | |
tree | 2df488bdf53b333434cead21a34273cbf9acc646 /src/core/lib | |
parent | 697a41f682f718f059505f7c3384004f4f0fa5cf (diff) |
force-set support for identity alg. in channel arg bitset
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/channel/channel_args.c | 7 | ||||
-rw-r--r-- | src/core/lib/channel/compress_filter.c | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/core/lib/channel/channel_args.c b/src/core/lib/channel/channel_args.c index 920b632abf..a171b41b35 100644 --- a/src/core/lib/channel/channel_args.c +++ b/src/core/lib/channel/channel_args.c @@ -199,7 +199,8 @@ static int find_compression_algorithm_states_bitset(const grpc_channel_args *a, !strcmp(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET, a->args[i].key)) { *states_arg = &a->args[i].value.integer; - return 1; /* GPR_TRUE */ + **states_arg |= 0x1; /* forcefully enable support for no compression */ + return 1; } } } @@ -216,7 +217,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( if (states_arg_found) { if (state != 0) { GPR_BITSET((unsigned *)states_arg, algorithm); - } else { + } else if (algorithm != GRPC_COMPRESS_NONE) { GPR_BITCLEAR((unsigned *)states_arg, algorithm); } } else { @@ -228,7 +229,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( tmp.value.integer = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; if (state != 0) { GPR_BITSET((unsigned *)&tmp.value.integer, algorithm); - } else { + } else if (algorithm != GRPC_COMPRESS_NONE) { GPR_BITCLEAR((unsigned *)&tmp.value.integer, algorithm); } result = grpc_channel_args_copy_and_add(*a, &tmp, 1); diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c index 9bda1aa47b..16e82ddee9 100644 --- a/src/core/lib/channel/compress_filter.c +++ b/src/core/lib/channel/compress_filter.c @@ -296,8 +296,8 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx, channeld->default_compression_algorithm = GRPC_COMPRESS_NONE; } - channeld->supported_compression_algorithms = 0; - for (grpc_compression_algorithm algo_idx = 0; + channeld->supported_compression_algorithms = 1; /* always support identity */ + for (grpc_compression_algorithm algo_idx = 1; algo_idx < GRPC_COMPRESS_ALGORITHMS_COUNT; ++algo_idx) { /* skip disabled algorithms */ if (!GPR_BITGET(channeld->enabled_algorithms_bitset, algo_idx)) { |