pull/11782/head
Muxi Yan 7 years ago
parent b32c23a9e7
commit df174ccd69
  1. 3
      src/core/ext/filters/http/message_compress/message_compress_filter.c
  2. 2
      src/core/lib/compression/compression.c
  3. 7
      src/core/lib/surface/call.c
  4. 10
      test/core/end2end/tests/stream_compressed_payload.c
  5. 10
      test/core/end2end/tests/stream_payload.c
  6. 10
      test/core/end2end/tests/stream_ping_pong_streaming.c

@ -118,7 +118,8 @@ static grpc_error *process_send_initial_metadata(
call_data *calld = elem->call_data;
channel_data *channeld = elem->channel_data;
*has_compression_algorithm = false;
grpc_stream_compression_algorithm stream_compression_algorithm;
grpc_stream_compression_algorithm stream_compression_algorithm =
GRPC_STREAM_COMPRESS_NONE;
if (initial_metadata->idx.named.grpc_internal_stream_encoding_request !=
NULL) {
grpc_mdelem md =

@ -172,6 +172,8 @@ void grpc_compression_options_init(grpc_compression_options *opts) {
memset(opts, 0, sizeof(*opts));
/* all enabled by default */
opts->enabled_algorithms_bitset = (1u << GRPC_COMPRESS_ALGORITHMS_COUNT) - 1;
opts->enabled_stream_compression_algorithms_bitset =
(1u << GRPC_STREAM_COMPRESS_ALGORITHMS_COUNT) - 1;
}
void grpc_compression_options_enable_algorithm(

@ -1613,14 +1613,15 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
/* process compression level */
memset(&compression_md, 0, sizeof(compression_md));
size_t additional_metadata_count = 0;
grpc_compression_level effective_compression_level = GRPC_COMPRESS_NONE;
grpc_compression_level effective_compression_level =
GRPC_COMPRESS_LEVEL_NONE;
grpc_stream_compression_level effective_stream_compression_level =
GRPC_STREAM_COMPRESS_NONE;
GRPC_STREAM_COMPRESS_LEVEL_NONE;
bool level_set = false;
bool stream_compression = false;
if (op->data.send_initial_metadata.maybe_stream_compression_level
.is_set) {
effective_compression_level =
effective_stream_compression_level =
op->data.send_initial_metadata.maybe_stream_compression_level
.level;
level_set = true;

@ -560,7 +560,7 @@ static void test_invoke_request_with_compressed_payload(
GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP,
GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, NULL,
false, /* ignored */
GRPC_COMPRESS_LEVEL_NONE, false, false, GRPC_COMPRESS_NONE);
GRPC_STREAM_COMPRESS_LEVEL_NONE, false, false, GRPC_COMPRESS_NONE);
}
static void test_invoke_request_with_send_message_before_initial_metadata(
@ -570,7 +570,7 @@ static void test_invoke_request_with_send_message_before_initial_metadata(
0, GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP,
GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_GZIP, NULL,
false, /* ignored */
GRPC_COMPRESS_LEVEL_NONE, true, false, GRPC_COMPRESS_NONE);
GRPC_STREAM_COMPRESS_LEVEL_NONE, true, false, GRPC_COMPRESS_NONE);
}
static void test_invoke_request_with_server_level(
@ -607,7 +607,8 @@ static void test_invoke_request_with_compressed_payload_md_override(
GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_NONE,
GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_NONE,
&gzip_compression_override, false,
/*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false, false, GRPC_COMPRESS_NONE);
/*ignored*/ GRPC_STREAM_COMPRESS_LEVEL_NONE, false, false,
GRPC_COMPRESS_NONE);
/* Channel default stream GZIP, call override to NONE (aka IDENTITY) */
request_with_payload_template(
@ -615,7 +616,8 @@ static void test_invoke_request_with_compressed_payload_md_override(
GRPC_STREAM_COMPRESS_GZIP, GRPC_STREAM_COMPRESS_NONE,
GRPC_STREAM_COMPRESS_NONE, GRPC_STREAM_COMPRESS_NONE,
&identity_compression_override, false,
/*ignored*/ GRPC_COMPRESS_LEVEL_NONE, false, false, GRPC_COMPRESS_NONE);
/*ignored*/ GRPC_STREAM_COMPRESS_LEVEL_NONE, false, false,
GRPC_COMPRESS_NONE);
}
static void test_invoke_request_with_disabled_algorithm(

@ -265,10 +265,12 @@ static void request_response_with_payload(grpc_end2end_test_config config,
payload and status. */
static void test_invoke_request_response_with_payload(
grpc_end2end_test_config config) {
grpc_channel_args *client_args = grpc_channel_args_set_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_GZIP);
grpc_channel_args *server_args = grpc_channel_args_set_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_GZIP);
grpc_channel_args *client_args =
grpc_channel_args_set_stream_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_GZIP);
grpc_channel_args *server_args =
grpc_channel_args_set_stream_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_GZIP);
grpc_end2end_test_fixture f =
begin_test(config, "test_invoke_request_response_with_payload",
client_args, server_args);

@ -90,10 +90,12 @@ static void end_test(grpc_end2end_test_fixture *f) {
/* Client pings and server pongs. Repeat messages rounds before finishing. */
static void test_pingpong_streaming(grpc_end2end_test_config config,
int messages) {
grpc_channel_args *client_args = grpc_channel_args_set_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_GZIP);
grpc_channel_args *server_args = grpc_channel_args_set_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_GZIP);
grpc_channel_args *client_args =
grpc_channel_args_set_stream_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_GZIP);
grpc_channel_args *server_args =
grpc_channel_args_set_stream_compression_algorithm(
NULL, GRPC_STREAM_COMPRESS_GZIP);
grpc_end2end_test_fixture f =
begin_test(config, "test_pingpong_streaming", client_args, server_args);
grpc_call *c;

Loading…
Cancel
Save