Skip to content
Snippets Groups Projects
Commit ddefbb82 authored by David Garcia Quintas's avatar David Garcia Quintas
Browse files

force-set support for identity alg. in channel arg bitset

parent 697a41f6
No related branches found
No related tags found
No related merge requests found
...@@ -199,7 +199,8 @@ static int find_compression_algorithm_states_bitset(const grpc_channel_args *a, ...@@ -199,7 +199,8 @@ static int find_compression_algorithm_states_bitset(const grpc_channel_args *a,
!strcmp(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET, !strcmp(GRPC_COMPRESSION_CHANNEL_ENABLED_ALGORITHMS_BITSET,
a->args[i].key)) { a->args[i].key)) {
*states_arg = &a->args[i].value.integer; *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( ...@@ -216,7 +217,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state(
if (states_arg_found) { if (states_arg_found) {
if (state != 0) { if (state != 0) {
GPR_BITSET((unsigned *)states_arg, algorithm); GPR_BITSET((unsigned *)states_arg, algorithm);
} else { } else if (algorithm != GRPC_COMPRESS_NONE) {
GPR_BITCLEAR((unsigned *)states_arg, algorithm); GPR_BITCLEAR((unsigned *)states_arg, algorithm);
} }
} else { } else {
...@@ -228,7 +229,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state( ...@@ -228,7 +229,7 @@ grpc_channel_args *grpc_channel_args_compression_algorithm_set_state(
tmp.value.integer = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1; tmp.value.integer = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1;
if (state != 0) { if (state != 0) {
GPR_BITSET((unsigned *)&tmp.value.integer, algorithm); GPR_BITSET((unsigned *)&tmp.value.integer, algorithm);
} else { } else if (algorithm != GRPC_COMPRESS_NONE) {
GPR_BITCLEAR((unsigned *)&tmp.value.integer, algorithm); GPR_BITCLEAR((unsigned *)&tmp.value.integer, algorithm);
} }
result = grpc_channel_args_copy_and_add(*a, &tmp, 1); result = grpc_channel_args_copy_and_add(*a, &tmp, 1);
......
...@@ -296,8 +296,8 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx, ...@@ -296,8 +296,8 @@ static void init_channel_elem(grpc_exec_ctx *exec_ctx,
channeld->default_compression_algorithm = GRPC_COMPRESS_NONE; channeld->default_compression_algorithm = GRPC_COMPRESS_NONE;
} }
channeld->supported_compression_algorithms = 0; channeld->supported_compression_algorithms = 1; /* always support identity */
for (grpc_compression_algorithm algo_idx = 0; for (grpc_compression_algorithm algo_idx = 1;
algo_idx < GRPC_COMPRESS_ALGORITHMS_COUNT; ++algo_idx) { algo_idx < GRPC_COMPRESS_ALGORITHMS_COUNT; ++algo_idx) {
/* skip disabled algorithms */ /* skip disabled algorithms */
if (!GPR_BITGET(channeld->enabled_algorithms_bitset, algo_idx)) { if (!GPR_BITGET(channeld->enabled_algorithms_bitset, algo_idx)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment