Merge branch 'master' of github.com:grpc/grpc into tv/watchOS

pull/19703/head^2
Tony Lu 6 years ago
commit 1efe2d9992
  1. 4
      gRPC-Core.podspec
  2. 10
      src/core/ext/filters/client_channel/client_channel.cc
  3. 6
      src/core/ext/filters/client_channel/health/health_check_client.cc
  4. 2
      src/core/ext/filters/client_channel/lb_policy/pick_first/pick_first.cc
  5. 67
      src/core/ext/filters/client_channel/subchannel.cc
  6. 31
      src/core/ext/filters/client_channel/subchannel.h
  7. 7
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  8. 65
      src/core/ext/transport/chttp2/transport/hpack_parser.cc
  9. 8
      src/core/ext/transport/chttp2/transport/hpack_parser.h
  10. 173
      src/core/ext/transport/chttp2/transport/hpack_table.cc
  11. 56
      src/core/ext/transport/chttp2/transport/hpack_table.h
  12. 33
      src/core/lib/channel/channelz.cc
  13. 11
      src/core/lib/channel/channelz.h
  14. 5
      src/core/lib/gprpp/debug_location.h
  15. 84
      src/core/lib/gprpp/ref_counted.h
  16. 3
      src/core/lib/iomgr/ev_posix.cc
  17. 2
      src/core/lib/iomgr/executor/mpmcqueue.cc
  18. 6
      src/core/lib/iomgr/fork_posix.cc
  19. 32
      src/core/lib/surface/server.cc
  20. 8
      src/core/lib/surface/server.h
  21. 8
      src/core/lib/transport/byte_stream.cc
  22. 3
      src/core/lib/transport/byte_stream.h
  23. 441
      src/core/lib/transport/static_metadata.cc
  24. 353
      src/core/lib/transport/static_metadata.h
  25. 11
      src/python/grpcio/grpc/__init__.py
  26. 2
      src/ruby/lib/grpc/generic/rpc_server.rb
  27. 4
      templates/gRPC-Core.podspec.template
  28. 4
      test/core/transport/chttp2/hpack_parser_test.cc
  29. 4
      test/core/transport/chttp2/hpack_table_test.cc
  30. 11
      test/cpp/interop/grpclb_fallback_test.cc
  31. 7
      test/cpp/microbenchmarks/bm_chttp2_hpack.cc
  32. 32
      tools/codegen/core/gen_static_metadata.py
  33. 114
      tools/release/verify_python_release.py
  34. 9
      tools/run_tests/run_interop_tests.py

@ -1388,7 +1388,7 @@ Pod::Spec.new do |s|
# TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path?
s.prepare_command = <<-END_OF_COMMAND
find src/core/ -type f -print0 | xargs -0 -L1 sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS\\\n #include <nanopb/\\1>\\\n#else\\\n #include "\\1"\\\n#endif;g'
find src/core/ -type f \\( -path '*.h' -or -path '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i '' 's;#include <openssl/(.*)>;#if COCOAPODS\\\n #include <openssl_grpc/\\1>\\\n#else\\\n #include <openssl/\\1>\\\n#endif;g'
sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include <nanopb/\\1>\\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include <nanopb/' | grep 0$ | cut -d':' -f1)
sed -E -i '' 's;#include <openssl/(.*)>;#if COCOAPODS==1\\\n #include <openssl_grpc/\\1>\\\n#else\\\n #include <openssl/\\1>\\\n#endif;g' $(find src/core -type f \\( -path '*.h' -or -path '*.cc' \\) -print | xargs grep -H -c '#include <openssl_grpc/' | grep 0$ | cut -d':' -f1)
END_OF_COMMAND
end

@ -2164,9 +2164,8 @@ void CallData::DoRetry(grpc_call_element* elem,
GPR_ASSERT(method_params_ != nullptr);
const auto* retry_policy = method_params_->retry_policy();
GPR_ASSERT(retry_policy != nullptr);
// Reset subchannel call and connected subchannel.
// Reset subchannel call.
subchannel_call_.reset();
connected_subchannel_.reset();
// Compute backoff delay.
grpc_millis next_attempt_time;
if (server_pushback_ms >= 0) {
@ -3284,13 +3283,14 @@ void CallData::CreateSubchannelCall(grpc_call_element* elem) {
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
const size_t parent_data_size =
enable_retries_ ? sizeof(SubchannelCallRetryState) : 0;
const ConnectedSubchannel::CallArgs call_args = {
pollent_, path_, call_start_time_, deadline_, arena_,
SubchannelCall::Args call_args = {
std::move(connected_subchannel_), pollent_, path_, call_start_time_,
deadline_, arena_,
// TODO(roth): When we implement hedging support, we will probably
// need to use a separate call context for each subchannel call.
call_context_, call_combiner_, parent_data_size};
grpc_error* error = GRPC_ERROR_NONE;
subchannel_call_ = connected_subchannel_->CreateCall(call_args, &error);
subchannel_call_ = SubchannelCall::Create(std::move(call_args), &error);
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO, "chand=%p calld=%p: create subchannel_call=%p: error=%s",
chand, this, subchannel_call_.get(), grpc_error_string(error));

@ -310,7 +310,8 @@ void HealthCheckClient::CallState::Orphan() {
}
void HealthCheckClient::CallState::StartCall() {
ConnectedSubchannel::CallArgs args = {
SubchannelCall::Args args = {
health_check_client_->connected_subchannel_,
&pollent_,
GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH,
gpr_now(GPR_CLOCK_MONOTONIC), // start_time
@ -321,8 +322,7 @@ void HealthCheckClient::CallState::StartCall() {
0, // parent_data_size
};
grpc_error* error = GRPC_ERROR_NONE;
call_ = health_check_client_->connected_subchannel_->CreateCall(args, &error)
.release();
call_ = SubchannelCall::Create(std::move(args), &error).release();
// Register after-destruction callback.
GRPC_CLOSURE_INIT(&after_call_stack_destruction_, AfterCallStackDestruction,
this, grpc_schedule_on_exec_ctx);

@ -176,7 +176,7 @@ void PickFirst::ExitIdleLocked() {
}
void PickFirst::ResetBackoffLocked() {
subchannel_list_->ResetBackoffLocked();
if (subchannel_list_ != nullptr) subchannel_list_->ResetBackoffLocked();
if (latest_pending_subchannel_list_ != nullptr) {
latest_pending_subchannel_list_->ResetBackoffLocked();
}

@ -117,14 +117,37 @@ void ConnectedSubchannel::Ping(grpc_closure* on_initiate,
elem->filter->start_transport_op(elem, op);
}
RefCountedPtr<SubchannelCall> ConnectedSubchannel::CreateCall(
const CallArgs& args, grpc_error** error) {
size_t ConnectedSubchannel::GetInitialCallSizeEstimate(
size_t parent_data_size) const {
size_t allocation_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(SubchannelCall));
if (parent_data_size > 0) {
allocation_size +=
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(channel_stack_->call_stack_size) +
parent_data_size;
} else {
allocation_size += channel_stack_->call_stack_size;
}
return allocation_size;
}
//
// SubchannelCall
//
RefCountedPtr<SubchannelCall> SubchannelCall::Create(Args args,
grpc_error** error) {
const size_t allocation_size =
GetInitialCallSizeEstimate(args.parent_data_size);
RefCountedPtr<SubchannelCall> call(
new (args.arena->Alloc(allocation_size))
SubchannelCall(Ref(DEBUG_LOCATION, "subchannel_call"), args));
grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(call.get());
args.connected_subchannel->GetInitialCallSizeEstimate(
args.parent_data_size);
return RefCountedPtr<SubchannelCall>(new (args.arena->Alloc(
allocation_size)) SubchannelCall(std::move(args), error));
}
SubchannelCall::SubchannelCall(Args args, grpc_error** error)
: connected_subchannel_(std::move(args.connected_subchannel)),
deadline_(args.deadline) {
grpc_call_stack* callstk = SUBCHANNEL_CALL_TO_CALL_STACK(this);
const grpc_call_element_args call_args = {
callstk, /* call_stack */
nullptr, /* server_transport_data */
@ -135,38 +158,20 @@ RefCountedPtr<SubchannelCall> ConnectedSubchannel::CreateCall(
args.arena, /* arena */
args.call_combiner /* call_combiner */
};
*error = grpc_call_stack_init(channel_stack_, 1, SubchannelCall::Destroy,
call.get(), &call_args);
*error = grpc_call_stack_init(connected_subchannel_->channel_stack(), 1,
SubchannelCall::Destroy, this, &call_args);
if (GPR_UNLIKELY(*error != GRPC_ERROR_NONE)) {
const char* error_string = grpc_error_string(*error);
gpr_log(GPR_ERROR, "error: %s", error_string);
return call;
return;
}
grpc_call_stack_set_pollset_or_pollset_set(callstk, args.pollent);
if (channelz_subchannel_ != nullptr) {
channelz_subchannel_->RecordCallStarted();
auto* channelz_node = connected_subchannel_->channelz_subchannel();
if (channelz_node != nullptr) {
channelz_node->RecordCallStarted();
}
return call;
}
size_t ConnectedSubchannel::GetInitialCallSizeEstimate(
size_t parent_data_size) const {
size_t allocation_size =
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(sizeof(SubchannelCall));
if (parent_data_size > 0) {
allocation_size +=
GPR_ROUND_UP_TO_ALIGNMENT_SIZE(channel_stack_->call_stack_size) +
parent_data_size;
} else {
allocation_size += channel_stack_->call_stack_size;
}
return allocation_size;
}
//
// SubchannelCall
//
void SubchannelCall::StartTransportStreamOpBatch(
grpc_transport_stream_op_batch* batch) {
GPR_TIMER_SCOPE("subchannel_call_process_op", 0);

@ -72,17 +72,6 @@ class SubchannelCall;
class ConnectedSubchannel : public ConnectedSubchannelInterface {
public:
struct CallArgs {
grpc_polling_entity* pollent;
grpc_slice path;
gpr_timespec start_time;
grpc_millis deadline;
Arena* arena;
grpc_call_context_element* context;
CallCombiner* call_combiner;
size_t parent_data_size;
};
ConnectedSubchannel(
grpc_channel_stack* channel_stack, const grpc_channel_args* args,
RefCountedPtr<channelz::SubchannelNode> channelz_subchannel);
@ -92,8 +81,6 @@ class ConnectedSubchannel : public ConnectedSubchannelInterface {
grpc_connectivity_state* state,
grpc_closure* closure);
void Ping(grpc_closure* on_initiate, grpc_closure* on_ack);
RefCountedPtr<SubchannelCall> CreateCall(const CallArgs& args,
grpc_error** error);
grpc_channel_stack* channel_stack() const { return channel_stack_; }
const grpc_channel_args* args() const override { return args_; }
@ -114,10 +101,18 @@ class ConnectedSubchannel : public ConnectedSubchannelInterface {
// Implements the interface of RefCounted<>.
class SubchannelCall {
public:
SubchannelCall(RefCountedPtr<ConnectedSubchannel> connected_subchannel,
const ConnectedSubchannel::CallArgs& args)
: connected_subchannel_(std::move(connected_subchannel)),
deadline_(args.deadline) {}
struct Args {
RefCountedPtr<ConnectedSubchannel> connected_subchannel;
grpc_polling_entity* pollent;
grpc_slice path;
gpr_timespec start_time;
grpc_millis deadline;
Arena* arena;
grpc_call_context_element* context;
CallCombiner* call_combiner;
size_t parent_data_size;
};
static RefCountedPtr<SubchannelCall> Create(Args args, grpc_error** error);
// Continues processing a transport stream op batch.
void StartTransportStreamOpBatch(grpc_transport_stream_op_batch* batch);
@ -150,6 +145,8 @@ class SubchannelCall {
template <typename T>
friend class RefCountedPtr;
SubchannelCall(Args args, grpc_error** error);
// If channelz is enabled, intercepts recv_trailing so that we may check the
// status and associate it to a subchannel.
void MaybeInterceptRecvTrailingMetadata(

@ -2016,9 +2016,10 @@ void grpc_chttp2_maybe_complete_recv_trailing_metadata(grpc_chttp2_transport* t,
* maybe decompress the next 5 bytes in the stream. */
if (s->stream_decompression_method ==
GRPC_STREAM_COMPRESSION_IDENTITY_DECOMPRESS) {
grpc_slice_buffer_move_first(&s->frame_storage,
GRPC_HEADER_SIZE_IN_BYTES,
&s->unprocessed_incoming_frames_buffer);
grpc_slice_buffer_move_first(
&s->frame_storage,
GPR_MIN(s->frame_storage.length, GRPC_HEADER_SIZE_IN_BYTES),
&s->unprocessed_incoming_frames_buffer);
if (s->unprocessed_incoming_frames_buffer.length > 0) {
s->unprocessed_incoming_frames_decompressed = true;
pending_data = true;

@ -779,6 +779,7 @@ static grpc_error* parse_indexed_field(grpc_chttp2_hpack_parser* p,
const uint8_t* cur, const uint8_t* end) {
p->dynamic_table_update_allowed = 0;
p->index = (*cur) & 0x7f;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
return finish_indexed_field(p, cur + 1, end);
}
@ -791,17 +792,32 @@ static grpc_error* parse_indexed_field_x(grpc_chttp2_hpack_parser* p,
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = 0x7f;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
p->parsing.value = &p->index;
return parse_value0(p, cur + 1, end);
}
/* When finishing with a header, get the cached md element for this index.
This is set in parse_value_string(). We ensure (in debug mode) that the
cached metadata corresponds with the index we are examining. */
static grpc_mdelem get_precomputed_md_for_idx(grpc_chttp2_hpack_parser* p) {
GPR_DEBUG_ASSERT(p->md_for_index.payload != 0);
GPR_DEBUG_ASSERT(static_cast<int64_t>(p->index) == p->precomputed_md_index);
grpc_mdelem md = p->md_for_index;
GPR_DEBUG_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
#ifndef NDEBUG
p->precomputed_md_index = -1;
#endif
return md;
}
/* finish a literal header with incremental indexing */
static grpc_error* finish_lithdr_incidx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
GRPC_STATS_INC_HPACK_RECV_LITHDR_INCIDX();
grpc_mdelem md = get_precomputed_md_for_idx(p);
grpc_error* err = on_hdr<true>(
p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
take_string(p, &p->value, true)));
@ -829,6 +845,7 @@ static grpc_error* parse_lithdr_incidx(grpc_chttp2_hpack_parser* p,
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = (*cur) & 0x3f;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
return parse_string_prefix(p, cur + 1, end);
}
@ -842,6 +859,7 @@ static grpc_error* parse_lithdr_incidx_x(grpc_chttp2_hpack_parser* p,
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = 0x3f;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
p->parsing.value = &p->index;
return parse_value0(p, cur + 1, end);
}
@ -862,9 +880,8 @@ static grpc_error* parse_lithdr_incidx_v(grpc_chttp2_hpack_parser* p,
static grpc_error* finish_lithdr_notidx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
GRPC_STATS_INC_HPACK_RECV_LITHDR_NOTIDX();
grpc_mdelem md = get_precomputed_md_for_idx(p);
grpc_error* err = on_hdr<false>(
p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
take_string(p, &p->value, false)));
@ -892,6 +909,7 @@ static grpc_error* parse_lithdr_notidx(grpc_chttp2_hpack_parser* p,
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = (*cur) & 0xf;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
return parse_string_prefix(p, cur + 1, end);
}
@ -905,6 +923,7 @@ static grpc_error* parse_lithdr_notidx_x(grpc_chttp2_hpack_parser* p,
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = 0xf;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
p->parsing.value = &p->index;
return parse_value0(p, cur + 1, end);
}
@ -925,9 +944,8 @@ static grpc_error* parse_lithdr_notidx_v(grpc_chttp2_hpack_parser* p,
static grpc_error* finish_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
const uint8_t* cur,
const uint8_t* end) {
grpc_mdelem md = grpc_chttp2_hptbl_lookup(&p->table, p->index);
GPR_ASSERT(!GRPC_MDISNULL(md)); /* handled in string parsing */
GRPC_STATS_INC_HPACK_RECV_LITHDR_NVRIDX();
grpc_mdelem md = get_precomputed_md_for_idx(p);
grpc_error* err = on_hdr<false>(
p, grpc_mdelem_from_slices(grpc_slice_ref_internal(GRPC_MDKEY(md)),
take_string(p, &p->value, false)));
@ -955,6 +973,7 @@ static grpc_error* parse_lithdr_nvridx(grpc_chttp2_hpack_parser* p,
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = (*cur) & 0xf;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
return parse_string_prefix(p, cur + 1, end);
}
@ -968,6 +987,7 @@ static grpc_error* parse_lithdr_nvridx_x(grpc_chttp2_hpack_parser* p,
p->dynamic_table_update_allowed = 0;
p->next_state = and_then;
p->index = 0xf;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
p->parsing.value = &p->index;
return parse_value0(p, cur + 1, end);
}
@ -1007,6 +1027,7 @@ static grpc_error* parse_max_tbl_size(grpc_chttp2_hpack_parser* p,
}
p->dynamic_table_update_allowed--;
p->index = (*cur) & 0x1f;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
return finish_max_tbl_size(p, cur + 1, end);
}
@ -1025,6 +1046,7 @@ static grpc_error* parse_max_tbl_size_x(grpc_chttp2_hpack_parser* p,
p->dynamic_table_update_allowed--;
p->next_state = and_then;
p->index = 0x1f;
p->md_for_index.payload = 0; /* Invalidate cached md when index changes. */
p->parsing.value = &p->index;
return parse_value0(p, cur + 1, end);
}
@ -1499,6 +1521,23 @@ static bool is_binary_literal_header(grpc_chttp2_hpack_parser* p) {
: p->key.data.referenced);
}
/* Cache the metadata for the given index during initial parsing. This avoids a
pointless recomputation of the metadata when finishing a header. We read the
cached value in get_precomputed_md_for_idx(). */
static void set_precomputed_md_idx(grpc_chttp2_hpack_parser* p,
grpc_mdelem md) {
GPR_DEBUG_ASSERT(p->md_for_index.payload == 0);
GPR_DEBUG_ASSERT(p->precomputed_md_index == -1);
p->md_for_index = md;
#ifndef NDEBUG
p->precomputed_md_index = p->index;
#endif
}
/* Determines if a metadata element key associated with the current parser index
is a binary indexed header during string parsing. We'll need to revisit this
metadata when we're done parsing, so we cache the metadata for this index
here using set_precomputed_md_idx(). */
static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
bool* is) {
grpc_mdelem elem = grpc_chttp2_hptbl_lookup(&p->table, p->index);
@ -1519,6 +1558,7 @@ static grpc_error* is_binary_indexed_header(grpc_chttp2_hpack_parser* p,
* interned.
* 4. Both static and interned element slices have non-null refcounts. */
*is = grpc_is_refcounted_slice_binary_header(GRPC_MDKEY(elem));
set_precomputed_md_idx(p, elem);
return GRPC_ERROR_NONE;
}
@ -1557,9 +1597,20 @@ void grpc_chttp2_hpack_parser_init(grpc_chttp2_hpack_parser* p) {
p->value.data.copied.str = nullptr;
p->value.data.copied.capacity = 0;
p->value.data.copied.length = 0;
/* Cached metadata for the current index the parser is handling. This is set
to 0 initially, invalidated when the index changes, and invalidated when it
is read (by get_precomputed_md_for_idx()). It is set during string parsing,
by set_precomputed_md_idx() - which is called by parse_value_string().
The goal here is to avoid recomputing the metadata for the index when
finishing with a header as well as the initial parse. */
p->md_for_index.payload = 0;
#ifndef NDEBUG
/* In debug mode, this ensures that the cached metadata we're reading is in
* fact correct for the index we are examining. */
p->precomputed_md_index = -1;
#endif
p->dynamic_table_update_allowed = 2;
p->last_error = GRPC_ERROR_NONE;
grpc_chttp2_hptbl_init(&p->table);
}
void grpc_chttp2_hpack_parser_set_has_priority(grpc_chttp2_hpack_parser* p) {

@ -69,6 +69,14 @@ struct grpc_chttp2_hpack_parser {
grpc_chttp2_hpack_parser_string value;
/* parsed index */
uint32_t index;
/* When we parse a value string, we determine the metadata element for a
specific index, which we need again when we're finishing up with that
header. To avoid calculating the metadata element for that index a second
time at that stage, we cache (and invalidate) the element here. */
grpc_mdelem md_for_index;
#ifndef NDEBUG
int64_t precomputed_md_index;
#endif
/* length of source bytes for the currently parsing string */
uint32_t strlen;
/* number of source bytes read for the currently parsing string */

@ -35,179 +35,18 @@
extern grpc_core::TraceFlag grpc_http_trace;
static struct {
const char* key;
const char* value;
} static_table[] = {
/* 0: */
{nullptr, nullptr},
/* 1: */
{":authority", ""},
/* 2: */
{":method", "GET"},
/* 3: */
{":method", "POST"},
/* 4: */
{":path", "/"},
/* 5: */
{":path", "/index.html"},
/* 6: */
{":scheme", "http"},
/* 7: */
{":scheme", "https"},
/* 8: */
{":status", "200"},
/* 9: */
{":status", "204"},
/* 10: */
{":status", "206"},
/* 11: */
{":status", "304"},
/* 12: */
{":status", "400"},
/* 13: */
{":status", "404"},
/* 14: */
{":status", "500"},
/* 15: */
{"accept-charset", ""},
/* 16: */
{"accept-encoding", "gzip, deflate"},
/* 17: */
{"accept-language", ""},
/* 18: */
{"accept-ranges", ""},
/* 19: */
{"accept", ""},
/* 20: */
{"access-control-allow-origin", ""},
/* 21: */
{"age", ""},
/* 22: */
{"allow", ""},
/* 23: */
{"authorization", ""},
/* 24: */
{"cache-control", ""},
/* 25: */
{"content-disposition", ""},
/* 26: */
{"content-encoding", ""},
/* 27: */
{"content-language", ""},
/* 28: */
{"content-length", ""},
/* 29: */
{"content-location", ""},
/* 30: */
{"content-range", ""},
/* 31: */
{"content-type", ""},
/* 32: */
{"cookie", ""},
/* 33: */
{"date", ""},
/* 34: */
{"etag", ""},
/* 35: */
{"expect", ""},
/* 36: */
{"expires", ""},
/* 37: */
{"from", ""},
/* 38: */
{"host", ""},
/* 39: */
{"if-match", ""},
/* 40: */
{"if-modified-since", ""},
/* 41: */
{"if-none-match", ""},
/* 42: */
{"if-range", ""},
/* 43: */
{"if-unmodified-since", ""},
/* 44: */
{"last-modified", ""},
/* 45: */
{"link", ""},
/* 46: */
{"location", ""},
/* 47: */
{"max-forwards", ""},
/* 48: */
{"proxy-authenticate", ""},
/* 49: */
{"proxy-authorization", ""},
/* 50: */
{"range", ""},
/* 51: */
{"referer", ""},
/* 52: */
{"refresh", ""},
/* 53: */
{"retry-after", ""},
/* 54: */
{"server", ""},
/* 55: */
{"set-cookie", ""},
/* 56: */
{"strict-transport-security", ""},
/* 57: */
{"transfer-encoding", ""},
/* 58: */
{"user-agent", ""},
/* 59: */
{"vary", ""},
/* 60: */
{"via", ""},
/* 61: */
{"www-authenticate", ""},
};
static uint32_t entries_for_bytes(uint32_t bytes) {
return (bytes + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) /
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
}
void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl* tbl) {
size_t i;
memset(tbl, 0, sizeof(*tbl));
tbl->current_table_bytes = tbl->max_bytes =
GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
tbl->max_entries = tbl->cap_entries =
entries_for_bytes(tbl->current_table_bytes);
tbl->ents = static_cast<grpc_mdelem*>(
gpr_malloc(sizeof(*tbl->ents) * tbl->cap_entries));
memset(tbl->ents, 0, sizeof(*tbl->ents) * tbl->cap_entries);
for (i = 1; i <= GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
tbl->static_ents[i - 1] = grpc_mdelem_from_slices(
grpc_slice_intern(
grpc_slice_from_static_string_internal(static_table[i].key)),
grpc_slice_intern(
grpc_slice_from_static_string_internal(static_table[i].value)));
}
}
void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl) {
size_t i;
for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
GRPC_MDELEM_UNREF(tbl->static_ents[i]);
}
for (i = 0; i < tbl->num_ents; i++) {
GRPC_MDELEM_UNREF(tbl->ents[(tbl->first_ent + i) % tbl->cap_entries]);
}
gpr_free(tbl->ents);
tbl->ents = nullptr;
}
grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
uint32_t tbl_index) {
/* Static table comes first, just return an entry from it */
if (tbl_index <= GRPC_CHTTP2_LAST_STATIC_ENTRY) {
return tbl->static_ents[tbl_index - 1];
}
/* Otherwise, find the value in the list of valid entries */
grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl,
uint32_t tbl_index) {
/* Not static - find the value in the list of valid entries */
tbl_index -= (GRPC_CHTTP2_LAST_STATIC_ENTRY + 1);
if (tbl_index < tbl->num_ents) {
uint32_t offset =
@ -280,7 +119,7 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
evict1(tbl);
}
tbl->current_table_bytes = bytes;
tbl->max_entries = entries_for_bytes(bytes);
tbl->max_entries = grpc_chttp2_hptbl::entries_for_bytes(bytes);
if (tbl->max_entries > tbl->cap_entries) {
rebuild_ents(tbl, GPR_MAX(tbl->max_entries, 2 * tbl->cap_entries));
} else if (tbl->max_entries < tbl->cap_entries / 3) {
@ -350,7 +189,7 @@ grpc_chttp2_hptbl_find_result grpc_chttp2_hptbl_find(
/* See if the string is in the static table */
for (i = 0; i < GRPC_CHTTP2_LAST_STATIC_ENTRY; i++) {
grpc_mdelem ent = tbl->static_ents[i];
grpc_mdelem ent = grpc_static_mdelem_manifested[i];
if (!grpc_slice_eq(GRPC_MDKEY(md), GRPC_MDKEY(ent))) continue;
r.index = i + 1u;
r.has_value = grpc_slice_eq(GRPC_MDVALUE(md), GRPC_MDVALUE(ent));

@ -22,6 +22,7 @@
#include <grpc/support/port_platform.h>
#include <grpc/slice.h>
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/static_metadata.h"
@ -46,32 +47,45 @@
#endif
/* hpack decoder table */
typedef struct {
struct grpc_chttp2_hptbl {
static uint32_t entries_for_bytes(uint32_t bytes) {
return (bytes + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD - 1) /
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
}
static constexpr uint32_t kInitialCapacity =
(GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE + GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD -
1) /
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
grpc_chttp2_hptbl() {
GPR_DEBUG_ASSERT(!ents);
constexpr uint32_t AllocSize = sizeof(*ents) * kInitialCapacity;
ents = static_cast<grpc_mdelem*>(gpr_malloc(AllocSize));
memset(ents, 0, AllocSize);
}
/* the first used entry in ents */
uint32_t first_ent;
uint32_t first_ent = 0;
/* how many entries are in the table */
uint32_t num_ents;
uint32_t num_ents = 0;
/* the amount of memory used by the table, according to the hpack algorithm */
uint32_t mem_used;
uint32_t mem_used = 0;
/* the max memory allowed to be used by the table, according to the hpack
algorithm */
uint32_t max_bytes;
uint32_t max_bytes = GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
/* the currently agreed size of the table, according to the hpack algorithm */
uint32_t current_table_bytes;
uint32_t current_table_bytes = GRPC_CHTTP2_INITIAL_HPACK_TABLE_SIZE;
/* Maximum number of entries we could possibly fit in the table, given defined
overheads */
uint32_t max_entries;
uint32_t max_entries = kInitialCapacity;
/* Number of entries allocated in ents */
uint32_t cap_entries;
uint32_t cap_entries = kInitialCapacity;
/* a circular buffer of headers - this is stored in the opposite order to
what hpack specifies, in order to simplify table management a little...
meaning lookups need to SUBTRACT from the end position */
grpc_mdelem* ents;
grpc_mdelem static_ents[GRPC_CHTTP2_LAST_STATIC_ENTRY];
} grpc_chttp2_hptbl;
grpc_mdelem* ents = nullptr;
};
/* initialize a hpack table */
void grpc_chttp2_hptbl_init(grpc_chttp2_hptbl* tbl);
void grpc_chttp2_hptbl_destroy(grpc_chttp2_hptbl* tbl);
void grpc_chttp2_hptbl_set_max_bytes(grpc_chttp2_hptbl* tbl,
uint32_t max_bytes);
@ -79,8 +93,20 @@ grpc_error* grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl* tbl,
uint32_t bytes);
/* lookup a table entry based on its hpack index */
grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
uint32_t index);
grpc_mdelem grpc_chttp2_hptbl_lookup_dynamic_index(const grpc_chttp2_hptbl* tbl,
uint32_t tbl_index);
inline grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
uint32_t index) {
/* Static table comes first, just return an entry from it.
NB: This imposes the constraint that the first
GRPC_CHTTP2_LAST_STATIC_ENTRY entries in the core static metadata table
must follow the hpack standard. If that changes, we *must* not rely on
reading the core static metadata table here; at that point we'd need our
own singleton static metadata in the correct order. */
return index <= GRPC_CHTTP2_LAST_STATIC_ENTRY
? grpc_static_mdelem_manifested[index - 1]
: grpc_chttp2_hptbl_lookup_dynamic_index(tbl, index);
}
/* add a table entry to the index */
grpc_error* grpc_chttp2_hptbl_add(grpc_chttp2_hptbl* tbl,
grpc_mdelem md) GRPC_MUST_USE_RESULT;

@ -309,31 +309,42 @@ ServerNode::ServerNode(grpc_server* server, size_t channel_tracer_max_nodes)
ServerNode::~ServerNode() {}
void ServerNode::AddChildSocket(RefCountedPtr<SocketNode> node) {
MutexLock lock(&child_mu_);
child_sockets_.insert(MakePair(node->uuid(), std::move(node)));
}
void ServerNode::RemoveChildSocket(intptr_t child_uuid) {
MutexLock lock(&child_mu_);
child_sockets_.erase(child_uuid);
}
char* ServerNode::RenderServerSockets(intptr_t start_socket_id,
intptr_t max_results) {
// if user does not set max_results, we choose 500.
// If user does not set max_results, we choose 500.
size_t pagination_limit = max_results == 0 ? 500 : max_results;
grpc_json* top_level_json = grpc_json_create(GRPC_JSON_OBJECT);
grpc_json* json = top_level_json;
grpc_json* json_iterator = nullptr;
ChildSocketsList socket_refs;
grpc_server_populate_server_sockets(server_, &socket_refs, start_socket_id);
// declared early so it can be used outside of the loop.
size_t i = 0;
if (!socket_refs.empty()) {
// create list of socket refs
MutexLock lock(&child_mu_);
size_t sockets_rendered = 0;
if (!child_sockets_.empty()) {
// Create list of socket refs
grpc_json* array_parent = grpc_json_create_child(
nullptr, json, "socketRef", nullptr, GRPC_JSON_ARRAY, false);
for (i = 0; i < GPR_MIN(socket_refs.size(), pagination_limit); ++i) {
const size_t limit = GPR_MIN(child_sockets_.size(), pagination_limit);
for (auto it = child_sockets_.lower_bound(start_socket_id);
it != child_sockets_.end() && sockets_rendered < limit;
++it, ++sockets_rendered) {
grpc_json* socket_ref_json = grpc_json_create_child(
nullptr, array_parent, nullptr, nullptr, GRPC_JSON_OBJECT, false);
json_iterator = grpc_json_add_number_string_child(
socket_ref_json, nullptr, "socketId", socket_refs[i]->uuid());
socket_ref_json, nullptr, "socketId", it->first);
grpc_json_create_child(json_iterator, socket_ref_json, "name",
socket_refs[i]->remote(), GRPC_JSON_STRING, false);
it->second->remote(), GRPC_JSON_STRING, false);
}
}
if (i == socket_refs.size()) {
if (sockets_rendered == child_sockets_.size()) {
json_iterator = grpc_json_create_child(nullptr, json, "end", nullptr,
GRPC_JSON_TRUE, false);
}

@ -64,7 +64,6 @@ intptr_t GetParentUuidFromArgs(const grpc_channel_args& args);
typedef InlinedVector<intptr_t, 10> ChildRefsList;
class SocketNode;
typedef InlinedVector<RefCountedPtr<SocketNode>, 10> ChildSocketsList;
namespace testing {
class CallCountingHelperPeer;
@ -207,12 +206,16 @@ class ChannelNode : public BaseNode {
class ServerNode : public BaseNode {
public:
ServerNode(grpc_server* server, size_t channel_tracer_max_nodes);
~ServerNode() override;
grpc_json* RenderJson() override;
char* RenderServerSockets(intptr_t start_socket_id,
intptr_t pagination_limit);
char* RenderServerSockets(intptr_t start_socket_id, intptr_t max_results);
void AddChildSocket(RefCountedPtr<SocketNode>);
void RemoveChildSocket(intptr_t child_uuid);
// proxy methods to composed classes.
void AddTraceEvent(ChannelTrace::Severity severity, const grpc_slice& data) {
@ -232,6 +235,8 @@ class ServerNode : public BaseNode {
grpc_server* server_;
CallCountingHelper call_counter_;
ChannelTrace trace_;
Mutex child_mu_; // Guards child map below.
Map<intptr_t, RefCountedPtr<SocketNode>> child_sockets_;
};
// Handles channelz bookkeeping for sockets

@ -25,10 +25,12 @@ namespace grpc_core {
// No-op for non-debug builds.
// Callers can use the DEBUG_LOCATION macro in either case.
#ifndef NDEBUG
// TODO(roth): See if there's a way to automatically populate this,
// similarly to how absl::SourceLocation::current() works, so that
// callers don't need to explicitly pass DEBUG_LOCATION anywhere.
class DebugLocation {
public:
DebugLocation(const char* file, int line) : file_(file), line_(line) {}
bool Log() const { return true; }
const char* file() const { return file_; }
int line() const { return line_; }
@ -40,7 +42,6 @@ class DebugLocation {
#else
class DebugLocation {
public:
bool Log() const { return false; }
const char* file() const { return nullptr; }
int line() const { return -1; }
};

@ -89,72 +89,114 @@ class RefCount {
}
// Increases the ref-count by `n`.
void Ref(Value n = 1) { value_.FetchAdd(n, MemoryOrder::RELAXED); }
void Ref(Value n = 1) {
#ifndef NDEBUG
const Value prior = value_.FetchAdd(n, MemoryOrder::RELAXED);
if (trace_flag_ != nullptr && trace_flag_->enabled()) {
gpr_log(GPR_INFO, "%s:%p ref %" PRIdPTR " -> %" PRIdPTR,
trace_flag_->name(), this, prior, prior + n);
}
#else
value_.FetchAdd(n, MemoryOrder::RELAXED);
#endif
}
void Ref(const DebugLocation& location, const char* reason, Value n = 1) {
#ifndef NDEBUG
if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
const RefCount::Value old_refs = get();
const Value prior = value_.FetchAdd(n, MemoryOrder::RELAXED);
if (trace_flag_ != nullptr && trace_flag_->enabled()) {
gpr_log(GPR_INFO, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s",
trace_flag_->name(), this, location.file(), location.line(),
old_refs, old_refs + n, reason);
prior, prior + n, reason);
}
#else
value_.FetchAdd(n, MemoryOrder::RELAXED);
#endif
Ref(n);
}
// Similar to Ref() with an assert on the ref-count being non-zero.
void RefNonZero() {
#ifndef NDEBUG
const Value prior = value_.FetchAdd(1, MemoryOrder::RELAXED);
if (trace_flag_ != nullptr && trace_flag_->enabled()) {
gpr_log(GPR_INFO, "%s:%p ref %" PRIdPTR " -> %" PRIdPTR,
trace_flag_->name(), this, prior, prior + 1);
}
assert(prior > 0);
#else
Ref();
value_.FetchAdd(1, MemoryOrder::RELAXED);
#endif
}
void RefNonZero(const DebugLocation& location, const char* reason) {
#ifndef NDEBUG
if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
const RefCount::Value old_refs = get();
const Value prior = value_.FetchAdd(1, MemoryOrder::RELAXED);
if (trace_flag_ != nullptr && trace_flag_->enabled()) {
gpr_log(GPR_INFO, "%s:%p %s:%d ref %" PRIdPTR " -> %" PRIdPTR " %s",
trace_flag_->name(), this, location.file(), location.line(),
old_refs, old_refs + 1, reason);
prior, prior + 1, reason);
}
#endif
assert(prior > 0);
#else
RefNonZero();
#endif
}
bool RefIfNonZero() { return value_.IncrementIfNonzero(); }
bool RefIfNonZero() {
#ifndef NDEBUG
if (trace_flag_ != nullptr && trace_flag_->enabled()) {
const Value prior = get();
gpr_log(GPR_INFO, "%s:%p ref_if_non_zero %" PRIdPTR " -> %" PRIdPTR,
trace_flag_->name(), this, prior, prior + 1);
}
#endif
return value_.IncrementIfNonzero();
}
bool RefIfNonZero(const DebugLocation& location, const char* reason) {
#ifndef NDEBUG
if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
const RefCount::Value old_refs = get();
if (trace_flag_ != nullptr && trace_flag_->enabled()) {
const Value prior = get();
gpr_log(GPR_INFO,
"%s:%p %s:%d ref_if_non_zero "
"%" PRIdPTR " -> %" PRIdPTR " %s",
trace_flag_->name(), this, location.file(), location.line(),
old_refs, old_refs + 1, reason);
prior, prior + 1, reason);
}
#endif
return RefIfNonZero();
return value_.IncrementIfNonzero();
}
// Decrements the ref-count and returns true if the ref-count reaches 0.
bool Unref() {
#ifndef NDEBUG
// Grab a copy of the trace flag before the atomic change, since we
// can't safely access it afterwards if we're going to be freed.
auto* trace_flag = trace_flag_;
#endif
const Value prior = value_.FetchSub(1, MemoryOrder::ACQ_REL);
#ifndef NDEBUG
if (trace_flag != nullptr && trace_flag->enabled()) {
gpr_log(GPR_INFO, "%s:%p unref %" PRIdPTR " -> %" PRIdPTR,
trace_flag->name(), this, prior, prior - 1);
}
GPR_DEBUG_ASSERT(prior > 0);
#endif
return prior == 1;
}
bool Unref(const DebugLocation& location, const char* reason) {
#ifndef NDEBUG
if (location.Log() && trace_flag_ != nullptr && trace_flag_->enabled()) {
const RefCount::Value old_refs = get();
// Grab a copy of the trace flag before the atomic change, since we
// can't safely access it afterwards if we're going to be freed.
auto* trace_flag = trace_flag_;
#endif
const Value prior = value_.FetchSub(1, MemoryOrder::ACQ_REL);
#ifndef NDEBUG
if (trace_flag != nullptr && trace_flag->enabled()) {
gpr_log(GPR_INFO, "%s:%p %s:%d unref %" PRIdPTR " -> %" PRIdPTR " %s",
trace_flag_->name(), this, location.file(), location.line(),
old_refs, old_refs - 1, reason);
trace_flag->name(), this, location.file(), location.line(), prior,
prior - 1, reason);
}
GPR_DEBUG_ASSERT(prior > 0);
#endif
return Unref();
return prior == 1;
}
private:

@ -206,7 +206,8 @@ void grpc_register_event_engine_factory(const char* name,
GPR_ASSERT(false);
}
/* Call this only after calling grpc_event_engine_init() */
/*If grpc_event_engine_init() has been called, returns the poll_strategy_name.
* Otherwise, returns nullptr. */
const char* grpc_get_poll_strategy_name() { return g_poll_strategy_name; }
void grpc_event_engine_init(void) {

@ -59,7 +59,7 @@ inline void* InfLenFIFOQueue::PopFront() {
}
Delete(head_to_remove);
// Singal waiting thread
// Signal waiting thread
if (count_.Load(MemoryOrder::RELAXED) > 0 && num_waiters_ > 0) {
wait_nonempty_.Signal();
}

@ -59,8 +59,10 @@ void grpc_prefork() {
"environment variable GRPC_ENABLE_FORK_SUPPORT=1");
return;
}
if (strcmp(grpc_get_poll_strategy_name(), "epoll1") != 0 &&
strcmp(grpc_get_poll_strategy_name(), "poll") != 0) {
const char* poll_strategy_name = grpc_get_poll_strategy_name();
if (poll_strategy_name == nullptr ||
(strcmp(poll_strategy_name, "epoll1") != 0 &&
strcmp(poll_strategy_name, "poll") != 0)) {
gpr_log(GPR_INFO,
"Fork support is only compatible with the epoll1 and poll polling "
"strategies");

@ -31,6 +31,7 @@
#include <utility>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/channelz.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/debug/stats.h"
#include "src/core/lib/gpr/mpscq.h"
@ -111,7 +112,7 @@ struct channel_data {
uint32_t registered_method_max_probes;
grpc_closure finish_destroy_channel_closure;
grpc_closure channel_connectivity_changed;
grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket_node;
intptr_t channelz_socket_uuid;
};
typedef struct shutdown_tag {
@ -941,7 +942,6 @@ static grpc_error* init_channel_elem(grpc_channel_element* elem,
static void destroy_channel_elem(grpc_channel_element* elem) {
size_t i;
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
chand->socket_node.reset();
if (chand->registered_methods) {
for (i = 0; i < chand->registered_method_slots; i++) {
grpc_slice_unref_internal(chand->registered_methods[i].method);
@ -952,6 +952,11 @@ static void destroy_channel_elem(grpc_channel_element* elem) {
gpr_free(chand->registered_methods);
}
if (chand->server) {
if (chand->server->channelz_server != nullptr &&
chand->channelz_socket_uuid != 0) {
chand->server->channelz_server->RemoveChildSocket(
chand->channelz_socket_uuid);
}
gpr_mu_lock(&chand->server->mu_global);
chand->next->prev = chand->prev;
chand->prev->next = chand->next;
@ -1144,7 +1149,8 @@ void grpc_server_get_pollsets(grpc_server* server, grpc_pollset*** pollsets,
void grpc_server_setup_transport(
grpc_server* s, grpc_transport* transport, grpc_pollset* accepting_pollset,
const grpc_channel_args* args,
grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket_node,
const grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode>&
socket_node,
grpc_resource_user* resource_user) {
size_t num_registered_methods;
size_t alloc;
@ -1166,7 +1172,12 @@ void grpc_server_setup_transport(
chand->server = s;
server_ref(s);
chand->channel = channel;
chand->socket_node = std::move(socket_node);
if (socket_node != nullptr) {
chand->channelz_socket_uuid = socket_node->uuid();
s->channelz_server->AddChildSocket(socket_node);
} else {
chand->channelz_socket_uuid = 0;
}
size_t cq_idx;
for (cq_idx = 0; cq_idx < s->cq_count; cq_idx++) {
@ -1241,19 +1252,6 @@ void grpc_server_setup_transport(
grpc_transport_perform_op(transport, op);
}
void grpc_server_populate_server_sockets(
grpc_server* s, grpc_core::channelz::ChildSocketsList* server_sockets,
intptr_t start_idx) {
gpr_mu_lock(&s->mu_global);
channel_data* c = nullptr;
for (c = s->root_channel_data.next; c != &s->root_channel_data; c = c->next) {
if (c->socket_node != nullptr && c->socket_node->uuid() >= start_idx) {
server_sockets->push_back(c->socket_node);
}
}
gpr_mu_unlock(&s->mu_global);
}
void grpc_server_populate_listen_sockets(
grpc_server* server, grpc_core::channelz::ChildRefsList* listen_sockets) {
gpr_mu_lock(&server->mu_global);

@ -47,14 +47,10 @@ void grpc_server_add_listener(grpc_server* server, void* listener,
void grpc_server_setup_transport(
grpc_server* server, grpc_transport* transport,
grpc_pollset* accepting_pollset, const grpc_channel_args* args,
grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> socket_node,
const grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode>&
socket_node,
grpc_resource_user* resource_user = nullptr);
/* fills in the uuids of all sockets used for connections on this server */
void grpc_server_populate_server_sockets(
grpc_server* server, grpc_core::channelz::ChildSocketsList* server_sockets,
intptr_t start_idx);
/* fills in the uuids of all listen sockets on this server */
void grpc_server_populate_listen_sockets(
grpc_server* server, grpc_core::channelz::ChildRefsList* listen_sockets);

@ -55,17 +55,15 @@ void SliceBufferByteStream::Orphan() {
bool SliceBufferByteStream::Next(size_t max_size_hint,
grpc_closure* on_complete) {
GPR_ASSERT(cursor_ < backing_buffer_.count);
GPR_DEBUG_ASSERT(backing_buffer_.count > 0);
return true;
}
grpc_error* SliceBufferByteStream::Pull(grpc_slice* slice) {
if (shutdown_error_ != GRPC_ERROR_NONE) {
if (GPR_UNLIKELY(shutdown_error_ != GRPC_ERROR_NONE)) {
return GRPC_ERROR_REF(shutdown_error_);
}
GPR_ASSERT(cursor_ < backing_buffer_.count);
*slice = grpc_slice_ref_internal(backing_buffer_.slices[cursor_]);
++cursor_;
*slice = grpc_slice_buffer_take_first(&backing_buffer_);
return GRPC_ERROR_NONE;
}

@ -99,9 +99,8 @@ class SliceBufferByteStream : public ByteStream {
void Shutdown(grpc_error* error) override;
private:
grpc_slice_buffer backing_buffer_;
size_t cursor_ = 0;
grpc_error* shutdown_error_ = GRPC_ERROR_NONE;
grpc_slice_buffer backing_buffer_;
};
//

@ -337,6 +337,447 @@ const grpc_slice grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT] = {
{&grpc_static_metadata_refcounts[106], {{21, g_bytes + 1234}}},
};
/* Warning: the core static metadata currently operates under the soft
constraint that the first GRPC_CHTTP2_LAST_STATIC_ENTRY (61) entries must
contain metadata specified by the http2 hpack standard. The CHTTP2 transport
reads the core metadata with this assumption in mind. If the order of the core
static metadata is to be changed, then the CHTTP2 transport must be changed as
well to stop relying on the core metadata. */
grpc_mdelem grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = {
// clang-format off
/* GRPC_MDELEM_AUTHORITY_EMPTY:
":authority": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[0].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_METHOD_GET:
":method": "GET" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[1].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_METHOD_POST:
":method": "POST" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[2].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_PATH_SLASH:
":path": "/" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[3].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML:
":path": "/index.html" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[4].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_SCHEME_HTTP:
":scheme": "http" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[5].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_SCHEME_HTTPS:
":scheme": "https" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[6].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_STATUS_200:
":status": "200" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[7].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_STATUS_204:
":status": "204" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[8].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_STATUS_206:
":status": "206" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[9].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_STATUS_304:
":status": "304" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[10].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_STATUS_400:
":status": "400" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[11].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_STATUS_404:
":status": "404" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[12].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_STATUS_500:
":status": "500" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[13].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_CHARSET_EMPTY:
"accept-charset": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[14].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE:
"accept-encoding": "gzip, deflate" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[15].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY:
"accept-language": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[16].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_RANGES_EMPTY:
"accept-ranges": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[17].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_EMPTY:
"accept": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[18].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY:
"access-control-allow-origin": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[19].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_AGE_EMPTY:
"age": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[20].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ALLOW_EMPTY:
"allow": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[21].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_AUTHORIZATION_EMPTY:
"authorization": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[22].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CACHE_CONTROL_EMPTY:
"cache-control": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[23].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY:
"content-disposition": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[24].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_ENCODING_EMPTY:
"content-encoding": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[25].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY:
"content-language": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[26].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_LENGTH_EMPTY:
"content-length": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[27].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_LOCATION_EMPTY:
"content-location": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[28].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_RANGE_EMPTY:
"content-range": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[29].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_TYPE_EMPTY:
"content-type": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[30].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_COOKIE_EMPTY:
"cookie": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[31].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_DATE_EMPTY:
"date": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[32].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ETAG_EMPTY:
"etag": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[33].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_EXPECT_EMPTY:
"expect": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[34].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_EXPIRES_EMPTY:
"expires": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[35].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_FROM_EMPTY:
"from": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[36].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_HOST_EMPTY:
"host": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[37].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_IF_MATCH_EMPTY:
"if-match": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[38].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY:
"if-modified-since": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[39].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_IF_NONE_MATCH_EMPTY:
"if-none-match": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[40].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_IF_RANGE_EMPTY:
"if-range": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[41].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY:
"if-unmodified-since": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[42].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_LAST_MODIFIED_EMPTY:
"last-modified": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[43].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_LINK_EMPTY:
"link": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[44].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_LOCATION_EMPTY:
"location": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[45].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_MAX_FORWARDS_EMPTY:
"max-forwards": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[46].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY:
"proxy-authenticate": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[47].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY:
"proxy-authorization": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[48].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_RANGE_EMPTY:
"range": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[49].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_REFERER_EMPTY:
"referer": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[50].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_REFRESH_EMPTY:
"refresh": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[51].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_RETRY_AFTER_EMPTY:
"retry-after": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[52].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_SERVER_EMPTY:
"server": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[53].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_SET_COOKIE_EMPTY:
"set-cookie": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[54].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY:
"strict-transport-security": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[55].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_TRANSFER_ENCODING_EMPTY:
"transfer-encoding": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[56].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_USER_AGENT_EMPTY:
"user-agent": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[57].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_VARY_EMPTY:
"vary": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[58].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_VIA_EMPTY:
"via": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[59].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY:
"www-authenticate": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[60].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_STATUS_0:
"grpc-status": "0" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[61].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_STATUS_1:
"grpc-status": "1" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[62].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_STATUS_2:
"grpc-status": "2" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[63].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ENCODING_IDENTITY:
"grpc-encoding": "identity" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[64].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ENCODING_GZIP:
"grpc-encoding": "gzip" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[65].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ENCODING_DEFLATE:
"grpc-encoding": "deflate" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[66].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_TE_TRAILERS:
"te": "trailers" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[67].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC:
"content-type": "application/grpc" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[68].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_SCHEME_GRPC:
":scheme": "grpc" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[69].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_METHOD_PUT:
":method": "PUT" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[70].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_ENCODING_EMPTY:
"accept-encoding": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[71].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_ENCODING_IDENTITY:
"content-encoding": "identity" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[72].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_CONTENT_ENCODING_GZIP:
"content-encoding": "gzip" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[73].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_LB_TOKEN_EMPTY:
"lb-token": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[74].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_LB_COST_BIN_EMPTY:
"lb-cost-bin": "" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[75].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY:
"grpc-accept-encoding": "identity" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[76].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE:
"grpc-accept-encoding": "deflate" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[77].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE:
"grpc-accept-encoding": "identity,deflate" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[78].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP:
"grpc-accept-encoding": "gzip" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[79].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP:
"grpc-accept-encoding": "identity,gzip" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[80].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP:
"grpc-accept-encoding": "deflate,gzip" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[81].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP:
"grpc-accept-encoding": "identity,deflate,gzip" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[82].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY:
"accept-encoding": "identity" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[83].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_ENCODING_GZIP:
"accept-encoding": "gzip" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[84].data(),
GRPC_MDELEM_STORAGE_STATIC),
/* GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP:
"accept-encoding": "identity,gzip" */
GRPC_MAKE_MDELEM(
&grpc_static_mdelem_table[85].data(),
GRPC_MDELEM_STORAGE_STATIC)
// clang-format on
};
uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

@ -272,350 +272,195 @@ extern grpc_slice_refcount
extern grpc_core::StaticMetadata
grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
extern uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];
extern grpc_mdelem grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT];
/* ":authority": "" */
#define GRPC_MDELEM_AUTHORITY_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[0].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_AUTHORITY_EMPTY (grpc_static_mdelem_manifested[0])
/* ":method": "GET" */
#define GRPC_MDELEM_METHOD_GET \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[1].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_METHOD_GET (grpc_static_mdelem_manifested[1])
/* ":method": "POST" */
#define GRPC_MDELEM_METHOD_POST \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[2].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_METHOD_POST (grpc_static_mdelem_manifested[2])
/* ":path": "/" */
#define GRPC_MDELEM_PATH_SLASH \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[3].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_PATH_SLASH (grpc_static_mdelem_manifested[3])
/* ":path": "/index.html" */
#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[4].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (grpc_static_mdelem_manifested[4])
/* ":scheme": "http" */
#define GRPC_MDELEM_SCHEME_HTTP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[5].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_SCHEME_HTTP (grpc_static_mdelem_manifested[5])
/* ":scheme": "https" */
#define GRPC_MDELEM_SCHEME_HTTPS \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[6].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_SCHEME_HTTPS (grpc_static_mdelem_manifested[6])
/* ":status": "200" */
#define GRPC_MDELEM_STATUS_200 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[7].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_STATUS_200 (grpc_static_mdelem_manifested[7])
/* ":status": "204" */
#define GRPC_MDELEM_STATUS_204 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[8].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_STATUS_204 (grpc_static_mdelem_manifested[8])
/* ":status": "206" */
#define GRPC_MDELEM_STATUS_206 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[9].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_STATUS_206 (grpc_static_mdelem_manifested[9])
/* ":status": "304" */
#define GRPC_MDELEM_STATUS_304 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[10].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_STATUS_304 (grpc_static_mdelem_manifested[10])
/* ":status": "400" */
#define GRPC_MDELEM_STATUS_400 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[11].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_STATUS_400 (grpc_static_mdelem_manifested[11])
/* ":status": "404" */
#define GRPC_MDELEM_STATUS_404 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[12].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_STATUS_404 (grpc_static_mdelem_manifested[12])
/* ":status": "500" */
#define GRPC_MDELEM_STATUS_500 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[13].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_STATUS_500 (grpc_static_mdelem_manifested[13])
/* "accept-charset": "" */
#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[14].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (grpc_static_mdelem_manifested[14])
/* "accept-encoding": "gzip, deflate" */
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[15].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \
(grpc_static_mdelem_manifested[15])
/* "accept-language": "" */
#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[16].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested[16])
/* "accept-ranges": "" */
#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[17].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (grpc_static_mdelem_manifested[17])
/* "accept": "" */
#define GRPC_MDELEM_ACCEPT_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[18].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_EMPTY (grpc_static_mdelem_manifested[18])
/* "access-control-allow-origin": "" */
#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[19].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \
(grpc_static_mdelem_manifested[19])
/* "age": "" */
#define GRPC_MDELEM_AGE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[20].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_AGE_EMPTY (grpc_static_mdelem_manifested[20])
/* "allow": "" */
#define GRPC_MDELEM_ALLOW_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[21].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ALLOW_EMPTY (grpc_static_mdelem_manifested[21])
/* "authorization": "" */
#define GRPC_MDELEM_AUTHORIZATION_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[22].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_AUTHORIZATION_EMPTY (grpc_static_mdelem_manifested[22])
/* "cache-control": "" */
#define GRPC_MDELEM_CACHE_CONTROL_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[23].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (grpc_static_mdelem_manifested[23])
/* "content-disposition": "" */
#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[24].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY \
(grpc_static_mdelem_manifested[24])
/* "content-encoding": "" */
#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[25].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (grpc_static_mdelem_manifested[25])
/* "content-language": "" */
#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[26].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested[26])
/* "content-length": "" */
#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[27].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (grpc_static_mdelem_manifested[27])
/* "content-location": "" */
#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[28].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (grpc_static_mdelem_manifested[28])
/* "content-range": "" */
#define GRPC_MDELEM_CONTENT_RANGE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[29].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (grpc_static_mdelem_manifested[29])
/* "content-type": "" */
#define GRPC_MDELEM_CONTENT_TYPE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[30].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (grpc_static_mdelem_manifested[30])
/* "cookie": "" */
#define GRPC_MDELEM_COOKIE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[31].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_COOKIE_EMPTY (grpc_static_mdelem_manifested[31])
/* "date": "" */
#define GRPC_MDELEM_DATE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[32].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_DATE_EMPTY (grpc_static_mdelem_manifested[32])
/* "etag": "" */
#define GRPC_MDELEM_ETAG_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[33].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ETAG_EMPTY (grpc_static_mdelem_manifested[33])
/* "expect": "" */
#define GRPC_MDELEM_EXPECT_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[34].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_EXPECT_EMPTY (grpc_static_mdelem_manifested[34])
/* "expires": "" */
#define GRPC_MDELEM_EXPIRES_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[35].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_EXPIRES_EMPTY (grpc_static_mdelem_manifested[35])
/* "from": "" */
#define GRPC_MDELEM_FROM_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[36].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_FROM_EMPTY (grpc_static_mdelem_manifested[36])
/* "host": "" */
#define GRPC_MDELEM_HOST_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[37].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_HOST_EMPTY (grpc_static_mdelem_manifested[37])
/* "if-match": "" */
#define GRPC_MDELEM_IF_MATCH_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[38].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_IF_MATCH_EMPTY (grpc_static_mdelem_manifested[38])
/* "if-modified-since": "" */
#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[39].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY (grpc_static_mdelem_manifested[39])
/* "if-none-match": "" */
#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[40].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (grpc_static_mdelem_manifested[40])
/* "if-range": "" */
#define GRPC_MDELEM_IF_RANGE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[41].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_IF_RANGE_EMPTY (grpc_static_mdelem_manifested[41])
/* "if-unmodified-since": "" */
#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[42].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY \
(grpc_static_mdelem_manifested[42])
/* "last-modified": "" */
#define GRPC_MDELEM_LAST_MODIFIED_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[43].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (grpc_static_mdelem_manifested[43])
/* "link": "" */
#define GRPC_MDELEM_LINK_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[44].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_LINK_EMPTY (grpc_static_mdelem_manifested[44])
/* "location": "" */
#define GRPC_MDELEM_LOCATION_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[45].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_LOCATION_EMPTY (grpc_static_mdelem_manifested[45])
/* "max-forwards": "" */
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[46].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (grpc_static_mdelem_manifested[46])
/* "proxy-authenticate": "" */
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[47].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested[47])
/* "proxy-authorization": "" */
#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[48].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \
(grpc_static_mdelem_manifested[48])
/* "range": "" */
#define GRPC_MDELEM_RANGE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[49].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_RANGE_EMPTY (grpc_static_mdelem_manifested[49])
/* "referer": "" */
#define GRPC_MDELEM_REFERER_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[50].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_REFERER_EMPTY (grpc_static_mdelem_manifested[50])
/* "refresh": "" */
#define GRPC_MDELEM_REFRESH_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[51].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_REFRESH_EMPTY (grpc_static_mdelem_manifested[51])
/* "retry-after": "" */
#define GRPC_MDELEM_RETRY_AFTER_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[52].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_RETRY_AFTER_EMPTY (grpc_static_mdelem_manifested[52])
/* "server": "" */
#define GRPC_MDELEM_SERVER_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[53].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_SERVER_EMPTY (grpc_static_mdelem_manifested[53])
/* "set-cookie": "" */
#define GRPC_MDELEM_SET_COOKIE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[54].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_SET_COOKIE_EMPTY (grpc_static_mdelem_manifested[54])
/* "strict-transport-security": "" */
#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[55].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
(grpc_static_mdelem_manifested[55])
/* "transfer-encoding": "" */
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[56].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (grpc_static_mdelem_manifested[56])
/* "user-agent": "" */
#define GRPC_MDELEM_USER_AGENT_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[57].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_USER_AGENT_EMPTY (grpc_static_mdelem_manifested[57])
/* "vary": "" */
#define GRPC_MDELEM_VARY_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[58].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_VARY_EMPTY (grpc_static_mdelem_manifested[58])
/* "via": "" */
#define GRPC_MDELEM_VIA_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[59].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_VIA_EMPTY (grpc_static_mdelem_manifested[59])
/* "www-authenticate": "" */
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[60].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested[60])
/* "grpc-status": "0" */
#define GRPC_MDELEM_GRPC_STATUS_0 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[61].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_STATUS_0 (grpc_static_mdelem_manifested[61])
/* "grpc-status": "1" */
#define GRPC_MDELEM_GRPC_STATUS_1 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[62].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_STATUS_1 (grpc_static_mdelem_manifested[62])
/* "grpc-status": "2" */
#define GRPC_MDELEM_GRPC_STATUS_2 \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[63].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_STATUS_2 (grpc_static_mdelem_manifested[63])
/* "grpc-encoding": "identity" */
#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[64].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY (grpc_static_mdelem_manifested[64])
/* "grpc-encoding": "gzip" */
#define GRPC_MDELEM_GRPC_ENCODING_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[65].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_ENCODING_GZIP (grpc_static_mdelem_manifested[65])
/* "grpc-encoding": "deflate" */
#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[66].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE (grpc_static_mdelem_manifested[66])
/* "te": "trailers" */
#define GRPC_MDELEM_TE_TRAILERS \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[67].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_TE_TRAILERS (grpc_static_mdelem_manifested[67])
/* "content-type": "application/grpc" */
#define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[68].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \
(grpc_static_mdelem_manifested[68])
/* ":scheme": "grpc" */
#define GRPC_MDELEM_SCHEME_GRPC \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[69].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_SCHEME_GRPC (grpc_static_mdelem_manifested[69])
/* ":method": "PUT" */
#define GRPC_MDELEM_METHOD_PUT \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[70].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_METHOD_PUT (grpc_static_mdelem_manifested[70])
/* "accept-encoding": "" */
#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[71].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY (grpc_static_mdelem_manifested[71])
/* "content-encoding": "identity" */
#define GRPC_MDELEM_CONTENT_ENCODING_IDENTITY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[72].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_ENCODING_IDENTITY \
(grpc_static_mdelem_manifested[72])
/* "content-encoding": "gzip" */
#define GRPC_MDELEM_CONTENT_ENCODING_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[73].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_CONTENT_ENCODING_GZIP (grpc_static_mdelem_manifested[73])
/* "lb-token": "" */
#define GRPC_MDELEM_LB_TOKEN_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[74].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_LB_TOKEN_EMPTY (grpc_static_mdelem_manifested[74])
/* "lb-cost-bin": "" */
#define GRPC_MDELEM_LB_COST_BIN_EMPTY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[75].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested[75])
/* "grpc-accept-encoding": "identity" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[76].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \
(grpc_static_mdelem_manifested[76])
/* "grpc-accept-encoding": "deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[77].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \
(grpc_static_mdelem_manifested[77])
/* "grpc-accept-encoding": "identity,deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[78].data(), \
GRPC_MDELEM_STORAGE_STATIC))
(grpc_static_mdelem_manifested[78])
/* "grpc-accept-encoding": "gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[79].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \
(grpc_static_mdelem_manifested[79])
/* "grpc-accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[80].data(), \
GRPC_MDELEM_STORAGE_STATIC))
(grpc_static_mdelem_manifested[80])
/* "grpc-accept-encoding": "deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[81].data(), \
GRPC_MDELEM_STORAGE_STATIC))
(grpc_static_mdelem_manifested[81])
/* "grpc-accept-encoding": "identity,deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[82].data(), \
GRPC_MDELEM_STORAGE_STATIC))
(grpc_static_mdelem_manifested[82])
/* "accept-encoding": "identity" */
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[83].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY (grpc_static_mdelem_manifested[83])
/* "accept-encoding": "gzip" */
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[84].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested[84])
/* "accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[85].data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(grpc_static_mdelem_manifested[85])
grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b);
typedef enum {

@ -339,8 +339,7 @@ class RpcContext(six.with_metaclass(abc.ABCMeta)):
callback: A no-parameter callable to be called on RPC termination.
Returns:
bool:
True if the callback was added and will be called later; False if
True if the callback was added and will be called later; False if
the callback was not added and will not be called (because the RPC
already terminated or some other reason).
"""
@ -1285,6 +1284,7 @@ class RpcMethodHandler(six.with_metaclass(abc.ABCMeta)):
class HandlerCallDetails(six.with_metaclass(abc.ABCMeta)):
"""Describes an RPC that has just arrived for service.
Attributes:
method: The method name of the RPC.
invocation_metadata: The :term:`metadata` sent by the client.
@ -1381,12 +1381,10 @@ class Server(six.with_metaclass(abc.ABCMeta)):
This method may only be called before starting the server.
Args:
address: The address for which to open a port.
if the port is 0, or not specified in the address, then gRPC runtime
will choose a port.
address: The address for which to open a port. If the port is 0,
or not specified in the address, then gRPC runtime will choose a port.
Returns:
integer:
An integer port on which server will accept RPC requests.
"""
raise NotImplementedError()
@ -1404,7 +1402,6 @@ class Server(six.with_metaclass(abc.ABCMeta)):
server_credentials: A ServerCredentials object.
Returns:
integer:
An integer port on which server will accept RPC requests.
"""
raise NotImplementedError()

@ -210,7 +210,7 @@ module GRPC
# A server arguments hash to be passed down to the underlying core server
#
# * interceptors:
# Am array of GRPC::ServerInterceptor objects that will be used for
# An array of GRPC::ServerInterceptor objects that will be used for
# intercepting server handlers to provide extra functionality.
# Interceptors are an EXPERIMENTAL API.
#

@ -212,7 +212,7 @@
# TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path?
s.prepare_command = <<-END_OF_COMMAND
find src/core/ -type f -print0 | xargs -0 -L1 sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS\\\n #include <nanopb/\\1>\\\n#else\\\n #include "\\1"\\\n#endif;g'
find src/core/ -type f \\( -path '*.h' -or -path '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i '' 's;#include <openssl/(.*)>;#if COCOAPODS\\\n #include <openssl_grpc/\\1>\\\n#else\\\n #include <openssl/\\1>\\\n#endif;g'
sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include <nanopb/\\1>\\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include <nanopb/' | grep 0$ | cut -d':' -f1)
sed -E -i '' 's;#include <openssl/(.*)>;#if COCOAPODS==1\\\n #include <openssl_grpc/\\1>\\\n#else\\\n #include <openssl/\\1>\\\n#endif;g' $(find src/core -type f \\( -path '*.h' -or -path '*.cc' \\) -print | xargs grep -H -c '#include <openssl_grpc/' | grep 0$ | cut -d':' -f1)
END_OF_COMMAND
end

@ -102,6 +102,7 @@ static void test_vectors(grpc_slice_split_mode mode) {
grpc_chttp2_hpack_parser_destroy(&parser);
grpc_chttp2_hpack_parser_init(&parser);
new (&parser.table) grpc_chttp2_hptbl();
/* D.3.1 */
test_vector(&parser, mode,
"8286 8441 0f77 7777 2e65 7861 6d70 6c65"
@ -122,6 +123,7 @@ static void test_vectors(grpc_slice_split_mode mode) {
grpc_chttp2_hpack_parser_destroy(&parser);
grpc_chttp2_hpack_parser_init(&parser);
new (&parser.table) grpc_chttp2_hptbl();
/* D.4.1 */
test_vector(&parser, mode,
"8286 8441 8cf1 e3c2 e5f2 3a6b a0ab 90f4"
@ -142,6 +144,7 @@ static void test_vectors(grpc_slice_split_mode mode) {
grpc_chttp2_hpack_parser_destroy(&parser);
grpc_chttp2_hpack_parser_init(&parser);
new (&parser.table) grpc_chttp2_hptbl();
grpc_chttp2_hptbl_set_max_bytes(&parser.table, 256);
grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
/* D.5.1 */
@ -176,6 +179,7 @@ static void test_vectors(grpc_slice_split_mode mode) {
grpc_chttp2_hpack_parser_destroy(&parser);
grpc_chttp2_hpack_parser_init(&parser);
new (&parser.table) grpc_chttp2_hptbl();
grpc_chttp2_hptbl_set_max_bytes(&parser.table, 256);
grpc_chttp2_hptbl_set_current_table_size(&parser.table, 256);
/* D.6.1 */

@ -48,8 +48,6 @@ static void test_static_lookup(void) {
grpc_core::ExecCtx exec_ctx;
grpc_chttp2_hptbl tbl;
grpc_chttp2_hptbl_init(&tbl);
LOG_TEST("test_static_lookup");
assert_index(&tbl, 1, ":authority", "");
assert_index(&tbl, 2, ":method", "GET");
@ -125,7 +123,6 @@ static void test_many_additions(void) {
LOG_TEST("test_many_additions");
grpc_core::ExecCtx exec_ctx;
grpc_chttp2_hptbl_init(&tbl);
for (i = 0; i < 100000; i++) {
grpc_mdelem elem;
@ -172,7 +169,6 @@ static void test_find(void) {
LOG_TEST("test_find");
grpc_chttp2_hptbl_init(&tbl);
elem = grpc_mdelem_from_slices(grpc_slice_from_static_string("abc"),
grpc_slice_from_static_string("xyz"));
GPR_ASSERT(grpc_chttp2_hptbl_add(&tbl, elem) == GRPC_ERROR_NONE);

@ -18,6 +18,8 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/port.h"
#include <arpa/inet.h>
#include <fcntl.h>
#include <gflags/gflags.h>
@ -67,6 +69,7 @@ DEFINE_string(
"slow_fallback_after_startup : fallback after startup due to LB/backend "
"addresses becoming blackholed;\n");
#ifdef GRPC_HAVE_TCP_USER_TIMEOUT
using grpc::testing::GrpclbRouteType;
using grpc::testing::SimpleRequest;
using grpc::testing::SimpleResponse;
@ -270,3 +273,11 @@ int main(int argc, char** argv) {
abort();
}
}
#else
int main(int argc, char** argv) {
grpc::testing::InitTest(&argc, &argv, true);
gpr_log(GPR_ERROR,
"This test requires TCP_USER_TIMEOUT, which isn't available");
abort();
}
#endif // GRPC_HAVE_TCP_USER_TIMEOUT

@ -433,8 +433,15 @@ static void BM_HpackParserInitDestroy(benchmark::State& state) {
TrackCounters track_counters;
grpc_core::ExecCtx exec_ctx;
grpc_chttp2_hpack_parser p;
// Initial destruction so we don't leak memory in the loop.
grpc_chttp2_hptbl_destroy(&p.table);
while (state.KeepRunning()) {
grpc_chttp2_hpack_parser_init(&p);
// Note that grpc_chttp2_hpack_parser_destroy frees the table dynamic
// elements so we need to recreate it here. In actual operation,
// grpc_core::New<grpc_chttp2_hpack_parser_destroy> allocates the table once
// and for all.
new (&p.table) grpc_chttp2_hptbl();
grpc_chttp2_hpack_parser_destroy(&p);
grpc_core::ExecCtx::Get()->Flush();
}

@ -451,11 +451,37 @@ print >> H, ('extern grpc_core::StaticMetadata '
'grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];')
print >> H, ('extern uintptr_t '
'grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT];')
print >> H, ('extern grpc_mdelem '
'grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT];')
print >> C, ('''
/* Warning: the core static metadata currently operates under the soft constraint
that the first GRPC_CHTTP2_LAST_STATIC_ENTRY (61) entries must contain
metadata specified by the http2 hpack standard. The CHTTP2 transport reads the
core metadata with this assumption in mind. If the order of the core static
metadata is to be changed, then the CHTTP2 transport must be changed as well to
stop relying on the core metadata. */
''')
print >> C, ('grpc_mdelem '
'grpc_static_mdelem_manifested[GRPC_STATIC_MDELEM_COUNT] = {')
print >> C, '// clang-format off'
static_mds = []
for i, elem in enumerate(all_elems):
md_name = mangle(elem).upper()
md_human_readable = '"%s": "%s"' % elem
md_spec = ' /* %s: \n %s */\n' % (md_name, md_human_readable)
md_spec += ' GRPC_MAKE_MDELEM(\n'
md_spec += ((' &grpc_static_mdelem_table[%d].data(),\n' % i) +
' GRPC_MDELEM_STORAGE_STATIC)')
static_mds.append(md_spec)
print >> C, ',\n'.join(static_mds)
print >> C, '// clang-format on'
print >> C, ('};')
for i, elem in enumerate(all_elems):
md_name = mangle(elem).upper()
print >> H, '/* "%s": "%s" */' % elem
print >> H, (
'#define %s (GRPC_MAKE_MDELEM(&grpc_static_mdelem_table[%d].data(), '
'GRPC_MDELEM_STORAGE_STATIC))') % (mangle(elem).upper(), i)
print >> H, ('#define %s (grpc_static_mdelem_manifested[%d])' % (md_name,
i))
print >> H
print >> C, ('uintptr_t grpc_static_mdelem_user_data[GRPC_STATIC_MDELEM_COUNT] '

@ -0,0 +1,114 @@
#!/usr/bin/env python3
#Copyright 2019 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Verifies that all gRPC Python artifacts have been successfully published.
This script is intended to be run from a directory containing the artifacts
that have been uploaded and only the artifacts that have been uploaded. We use
PyPI's JSON API to verify that the proper filenames and checksums are present.
Note that PyPI may take several minutes to update its metadata. Don't have a
heart attack immediately.
This sanity check is a good first step, but ideally, we would automate the
entire release process.
"""
import argparse
import collections
import hashlib
import os
import requests
import sys
_DEFAULT_PACKAGES = [
"grpcio",
"grpcio-tools",
"grpcio-status",
"grpcio-health-checking",
"grpcio-reflection",
"grpcio-channelz",
"grpcio-testing",
]
Artifact = collections.namedtuple("Artifact", ("filename", "checksum"))
def _get_md5_checksum(filename):
"""Calculate the md5sum for a file."""
hash_md5 = hashlib.md5()
with open(filename, 'rb') as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
def _get_local_artifacts():
"""Get a set of artifacts representing all files in the cwd."""
return set(
Artifact(f, _get_md5_checksum(f)) for f in os.listdir(os.getcwd()))
def _get_remote_artifacts_for_package(package, version):
"""Get a list of artifacts based on PyPi's json metadata.
Note that this data will not updated immediately after upload. In my
experience, it has taken a minute on average to be fresh.
"""
artifacts = set()
payload = requests.get("https://pypi.org/pypi/{}/{}/json".format(
package, version)).json()
for download_info in payload['releases'][version]:
artifacts.add(
Artifact(download_info['filename'], download_info['md5_digest']))
return artifacts
def _get_remote_artifacts_for_packages(packages, version):
artifacts = set()
for package in packages:
artifacts |= _get_remote_artifacts_for_package(package, version)
return artifacts
def _verify_release(version, packages):
"""Compare the local artifacts to the packages uploaded to PyPI."""
local_artifacts = _get_local_artifacts()
remote_artifacts = _get_remote_artifacts_for_packages(packages, version)
if local_artifacts != remote_artifacts:
local_but_not_remote = local_artifacts - remote_artifacts
remote_but_not_local = remote_artifacts - local_artifacts
if local_but_not_remote:
print("The following artifacts exist locally but not remotely.")
for artifact in local_but_not_remote:
print(artifact)
if remote_but_not_local:
print("The following artifacts exist remotely but not locally.")
for artifact in remote_but_not_local:
print(artifact)
sys.exit(1)
print("Release verified successfully.")
if __name__ == "__main__":
parser = argparse.ArgumentParser(
"Verify a release. Run this from a directory containing only the"
"artifacts to be uploaded. Note that PyPI may take several minutes"
"after the upload to reflect the proper metadata.")
parser.add_argument("version")
parser.add_argument(
"packages", nargs='*', type=str, default=_DEFAULT_PACKAGES)
args = parser.parse_args()
_verify_release(args.version, args.packages)

@ -208,7 +208,10 @@ class AspNetCoreLanguage:
def unimplemented_test_cases(self):
return _SKIP_COMPRESSION + \
_AUTH_TEST_CASES
['compute_engine_creds'] + \
['jwt_token_creds'] + \
_SKIP_GOOGLE_DEFAULT_CREDS + \
_SKIP_COMPUTE_ENGINE_CHANNEL_CREDS
def unimplemented_test_cases_server(self):
return _SKIP_COMPRESSION
@ -821,8 +824,8 @@ def auth_options(language, test_case, google_default_creds_use_key_file,
if test_case in ['jwt_token_creds', 'per_rpc_creds', 'oauth2_auth_token']:
if language in [
'csharp', 'csharpcoreclr', 'node', 'php', 'php7', 'python',
'ruby', 'nodepurejs'
'csharp', 'csharpcoreclr', 'aspnetcore', 'node', 'php', 'php7',
'python', 'ruby', 'nodepurejs'
]:
env['GOOGLE_APPLICATION_CREDENTIALS'] = service_account_key_file
else:

Loading…
Cancel
Save