Fix internal_data to be the same size as the new grpc_linked_mdelem

reviewable/pr16488/r2
Hope Casey-Allen 7 years ago
parent 8a8ed0e711
commit 33d87e3ffd
  1. 1
      include/grpc/impl/codegen/grpc_types.h
  2. 9
      src/core/ext/transport/chttp2/transport/hpack_encoder.cc
  3. 2
      src/core/ext/transport/chttp2/transport/hpack_encoder.h
  4. 6
      src/core/ext/transport/chttp2/transport/writing.cc
  5. 2
      src/core/lib/transport/metadata_batch.cc
  6. 4
      test/core/end2end/tests/authority_not_supported.cc
  7. 8
      test/core/end2end/tests/binary_metadata.cc
  8. 8
      test/core/end2end/tests/simple_cacheable_request.cc
  9. 8
      test/core/end2end/tests/simple_metadata.cc
  10. 12
      test/core/end2end/tests/trailing_metadata.cc

@ -438,6 +438,7 @@ typedef struct grpc_metadata {
There is no need to initialize them, and they will be set to garbage
during calls to grpc. */
struct /* internal */ {
uint8_t obfuscated_byte;
void* obfuscated[4];
} internal_data;
} grpc_metadata;

@ -663,7 +663,7 @@ void grpc_chttp2_hpack_compressor_set_max_table_size(
}
void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
grpc_mdelem** extra_headers,
grpc_linked_mdelem** extra_headers,
size_t extra_headers_size,
grpc_metadata_batch* metadata,
const grpc_encode_header_options* options,
@ -688,7 +688,12 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
emit_advertise_table_size_change(c, &st);
}
for (size_t i = 0; i < extra_headers_size; ++i) {
hpack_enc(c, *extra_headers[i], &st);
grpc_linked_mdelem* linked_md = extra_headers[i];
if (is_valid_mdelem_index(linked_md->md_index)) {
emit_indexed(c, linked_md->md_index, &st);
} else {
hpack_enc(c, linked_md->md, &st);
}
}
grpc_metadata_batch_assert_ok(metadata);
for (grpc_linked_mdelem* l = metadata->list.head; l; l = l->next) {

@ -87,7 +87,7 @@ typedef struct {
} grpc_encode_header_options;
void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor* c,
grpc_mdelem** extra_headers,
grpc_linked_mdelem** extra_headers,
size_t extra_headers_size,
grpc_metadata_batch* metadata,
const grpc_encode_header_options* options,

@ -557,12 +557,12 @@ class StreamWriteContext {
if (s_->send_initial_metadata->idx.named.status != nullptr) {
extra_headers_for_trailing_metadata_
[num_extra_headers_for_trailing_metadata_++] =
&s_->send_initial_metadata->idx.named.status->md;
s_->send_initial_metadata->idx.named.status;
}
if (s_->send_initial_metadata->idx.named.content_type != nullptr) {
extra_headers_for_trailing_metadata_
[num_extra_headers_for_trailing_metadata_++] =
&s_->send_initial_metadata->idx.named.content_type->md;
s_->send_initial_metadata->idx.named.content_type;
}
}
@ -583,7 +583,7 @@ class StreamWriteContext {
grpc_chttp2_transport* const t_;
grpc_chttp2_stream* const s_;
bool stream_became_writable_ = false;
grpc_mdelem* extra_headers_for_trailing_metadata_[2];
grpc_linked_mdelem* extra_headers_for_trailing_metadata_[2];
size_t num_extra_headers_for_trailing_metadata_ = 0;
};
} // namespace

@ -151,7 +151,7 @@ static void assert_valid_callouts(grpc_metadata_batch* batch) {
grpc_metadata_batch_callouts_index callout_idx;
if (is_mdelem_index_used(l->md_index)) {
GPR_ASSERT(is_valid_mdelem_index(l->md_index));
callout_idx = get_callouts_index(l->md_index);
callout_idx = get_callouts_index(l);
if (callout_idx != GRPC_BATCH_CALLOUTS_COUNT) {
GPR_ASSERT(batch->idx.array[callout_idx] == l);
}

@ -93,11 +93,11 @@ static void test_with_authority_header(grpc_end2end_test_config config) {
grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key2"),
grpc_slice_from_static_string("val2"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_end2end_test_fixture f =
begin_test(config, "test_with_authority_header", nullptr, nullptr);
cq_verifier* cqv = cq_verifier_create(f.cq);

@ -101,23 +101,23 @@ static void test_request_response_with_metadata_and_payload(
grpc_slice_from_static_string(
"\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key2-bin"),
grpc_slice_from_static_string(
"\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_metadata meta_s[2] = {
{grpc_slice_from_static_string("key3-bin"),
grpc_slice_from_static_string(
"\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key4-bin"),
grpc_slice_from_static_string(
"\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe\xff"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_end2end_test_fixture f =
begin_test(config, "test_request_response_with_metadata_and_payload",
nullptr, nullptr);

@ -101,19 +101,19 @@ static void test_cacheable_request_response_with_metadata_and_payload(
grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key2"),
grpc_slice_from_static_string("val2"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_metadata meta_s[2] = {{grpc_slice_from_static_string("key3"),
grpc_slice_from_static_string("val3"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key4"),
grpc_slice_from_static_string("val4"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_end2end_test_fixture f = begin_test(
config, "test_cacheable_request_response_with_metadata_and_payload",
nullptr, nullptr);

@ -99,19 +99,19 @@ static void test_request_response_with_metadata_and_payload(
grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key2"),
grpc_slice_from_static_string("val2"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_metadata meta_s[2] = {{grpc_slice_from_static_string("key3"),
grpc_slice_from_static_string("val3"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key4"),
grpc_slice_from_static_string("val4"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_end2end_test_fixture f =
begin_test(config, "test_request_response_with_metadata_and_payload",
nullptr, nullptr);

@ -99,27 +99,27 @@ static void test_request_response_with_metadata_and_payload(
grpc_metadata meta_c[2] = {{grpc_slice_from_static_string("key1"),
grpc_slice_from_static_string("val1"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key2"),
grpc_slice_from_static_string("val2"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_metadata meta_s[2] = {{grpc_slice_from_static_string("key3"),
grpc_slice_from_static_string("val3"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key4"),
grpc_slice_from_static_string("val4"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_metadata meta_t[2] = {{grpc_slice_from_static_string("key5"),
grpc_slice_from_static_string("val5"),
0,
{{nullptr, nullptr, nullptr, nullptr}}},
{0, {nullptr, nullptr, nullptr, nullptr}}},
{grpc_slice_from_static_string("key6"),
grpc_slice_from_static_string("val6"),
0,
{{nullptr, nullptr, nullptr, nullptr}}}};
{0, {nullptr, nullptr, nullptr, nullptr}}}};
grpc_end2end_test_fixture f =
begin_test(config, "test_request_response_with_metadata_and_payload",
nullptr, nullptr);

Loading…
Cancel
Save