Merge branch 'master' into move-method-handler

pull/20030/head
Karthik Ravi Shankar 6 years ago
commit de2006d3e1
  1. 2
      .github/ISSUE_TEMPLATE/bug_report.md
  2. 2
      .github/ISSUE_TEMPLATE/cleanup_request.md
  3. 2
      .github/ISSUE_TEMPLATE/feature_request.md
  4. 2
      .github/pull_request_template.md
  5. 1
      .gitignore
  6. 9
      BUILD
  7. 2
      BUILDING.md
  8. 2
      CMakeLists.txt
  9. 4
      Makefile
  10. 1
      Rakefile
  11. 3
      bazel/grpc_build_system.bzl
  12. 16
      bazel/grpc_deps.bzl
  13. 8
      bazel/python_rules.bzl
  14. 6
      bazel/test/python_test_repo/BUILD
  15. 3
      build.yaml
  16. 4
      config.m4
  17. 1
      config.w32
  18. 2
      examples/BUILD
  19. 2
      examples/python/cancellation/BUILD.bazel
  20. 2
      examples/python/multiprocessing/BUILD
  21. 2
      gRPC-C++.podspec
  22. 4
      gRPC-Core.podspec
  23. 3
      grpc.gyp
  24. 9
      include/grpc/impl/codegen/port_platform.h
  25. 1
      setup.py
  26. 19
      src/core/ext/filters/client_channel/client_channel.cc
  27. 4
      src/core/ext/filters/client_channel/client_channel_factory.h
  28. 10
      src/core/ext/filters/client_channel/http_proxy.cc
  29. 2
      src/core/ext/filters/client_channel/lb_policy.cc
  30. 61
      src/core/ext/filters/client_channel/lb_policy.h
  31. 23
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  32. 15
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc
  33. 11
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h
  34. 52
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel_secure.cc
  35. 38
      src/core/ext/filters/client_channel/lb_policy/xds/xds.cc
  36. 14
      src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.cc
  37. 10
      src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h
  38. 45
      src/core/ext/filters/client_channel/lb_policy/xds/xds_channel_secure.cc
  39. 8
      src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.cc
  40. 8
      src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc
  41. 3
      src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h
  42. 11
      src/core/ext/filters/client_channel/resolving_lb_policy.cc
  43. 31
      src/core/ext/filters/load_reporting/registered_opencensus_objects.h
  44. 43
      src/core/ext/transport/chttp2/client/insecure/channel_create.cc
  45. 45
      src/core/ext/transport/chttp2/client/secure/secure_channel_create.cc
  46. 7
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  47. 2
      src/core/ext/transport/chttp2/transport/hpack_table.cc
  48. 4
      src/core/ext/transport/chttp2/transport/hpack_table.h
  49. 3
      src/core/lib/channel/channelz.h
  50. 4
      src/core/lib/gpr/log_linux.cc
  51. 4
      src/core/lib/gpr/log_posix.cc
  52. 10
      src/core/lib/gprpp/abstract.h
  53. 87
      src/core/lib/gprpp/map.h
  54. 4
      src/core/lib/iomgr/ev_epollex_linux.cc
  55. 2
      src/core/lib/iomgr/tcp_server_custom.cc
  56. 10
      src/core/lib/security/credentials/credentials.h
  57. 20
      src/core/lib/slice/slice_intern.cc
  58. 2
      src/core/lib/slice/slice_internal.h
  59. 10
      src/core/lib/slice/slice_utils.h
  60. 3
      src/core/lib/surface/init.cc
  61. 8
      src/core/lib/transport/metadata.cc
  62. 1648
      src/core/lib/transport/static_metadata.cc
  63. 454
      src/core/lib/transport/static_metadata.h
  64. 2
      src/cpp/client/secure_credentials.cc
  65. 17
      src/cpp/ext/filters/census/grpc_plugin.cc
  66. 9
      src/cpp/ext/filters/census/grpc_plugin.h
  67. 11
      src/cpp/server/load_reporter/load_reporter.cc
  68. 11
      src/cpp/server/load_reporter/load_reporter.h
  69. 2
      src/csharp/experimental/README.md
  70. 3
      src/objective-c/tests/BUILD
  71. 3
      src/objective-c/tests/Tests.xcodeproj/project.pbxproj
  72. 6
      src/proto/grpc/testing/BUILD
  73. 4
      src/proto/grpc/testing/proto2/BUILD.bazel
  74. 61
      src/python/grpcio/grpc/__init__.py
  75. 5
      src/python/grpcio/grpc/_cython/_cygrpc/credentials.pxd.pxi
  76. 22
      src/python/grpcio/grpc/_cython/_cygrpc/credentials.pyx.pxi
  77. 12
      src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
  78. 2
      src/python/grpcio_channelz/grpc_channelz/v1/BUILD.bazel
  79. 2
      src/python/grpcio_health_checking/grpc_health/v1/BUILD.bazel
  80. 2
      src/python/grpcio_reflection/grpc_reflection/v1alpha/BUILD.bazel
  81. 3
      src/python/grpcio_testing/grpc_testing/_server/_servicer_context.py
  82. 4
      src/python/grpcio_tests/commands.py
  83. 1
      src/python/grpcio_tests/tests/tests.json
  84. 1
      src/python/grpcio_tests/tests/unit/BUILD.bazel
  85. 3
      src/python/grpcio_tests/tests/unit/_api_test.py
  86. 75
      src/python/grpcio_tests/tests/unit/_local_credentials_test.py
  87. 2
      templates/CMakeLists.txt.template
  88. 2
      templates/Makefile.template
  89. 4
      templates/config.m4.template
  90. 1
      templates/config.w32.template
  91. 2
      templates/gRPC-C++.podspec.template
  92. 4
      templates/gRPC-Core.podspec.template
  93. 3
      templates/tools/dockerfile/debian_testing_repo.include
  94. 2
      templates/tools/dockerfile/interoptest/grpc_interop_python/Dockerfile.template
  95. 4
      templates/tools/dockerfile/python_stretch.include
  96. 2
      templates/tools/dockerfile/test/cxx_jessie_x86/Dockerfile.template
  97. 16
      templates/tools/dockerfile/test/python_stretch_3.6_x64/Dockerfile.template
  98. 2
      templates/tools/dockerfile/test/python_stretch_3.7_x64/Dockerfile.template
  99. 13
      templates/tools/dockerfile/test/python_stretch_3.8_x64/Dockerfile.template
  100. 2
      templates/tools/dockerfile/test/sanity/Dockerfile.template
  101. Some files were not shown because too many files have changed in this diff Show More

@ -2,7 +2,7 @@
name: Report a bug
about: Create a report to help us improve
labels: kind/bug, priority/P2
assignees: AspirinSJL
assignees: mhaidrygoog
---

@ -2,7 +2,7 @@
name: Request a cleanup
about: Suggest a cleanup in our repository
labels: kind/internal cleanup
assignees: AspirinSJL
assignees: mhaidrygoog
---

@ -2,7 +2,7 @@
name: Request a feature
about: Suggest an idea for this project
labels: kind/enhancement
assignees: AspirinSJL
assignees: mhaidrygoog
---

@ -8,4 +8,4 @@ If you know who should review your pull request, please remove the mentioning be
-->
@AspirinSJL
@mhaidrygoog

1
.gitignore vendored

@ -140,6 +140,7 @@ bm_*.json
# Visual Studio Code artifacts
.vscode/*
.history/
# Clion artifacts
cmake-build-debug/

@ -73,6 +73,11 @@ config_setting(
values = {"cpu": "darwin"},
)
config_setting(
name = "grpc_use_cpp_std_lib",
values = {"define": "GRPC_USE_CPP_STD_LIB=1"},
)
# This should be updated along with build.yaml
g_stands_for = "ganges"
@ -1216,6 +1221,7 @@ grpc_cc_library(
"grpc_client_channel",
"grpc_lb_upb",
"grpc_resolver_fake",
"grpc_transport_chttp2_client_insecure",
],
)
@ -1242,6 +1248,7 @@ grpc_cc_library(
"grpc_lb_upb",
"grpc_resolver_fake",
"grpc_secure",
"grpc_transport_chttp2_client_secure",
],
)
@ -1265,6 +1272,7 @@ grpc_cc_library(
"grpc_base",
"grpc_client_channel",
"grpc_resolver_fake",
"grpc_transport_chttp2_client_insecure",
],
)
@ -1289,6 +1297,7 @@ grpc_cc_library(
"grpc_client_channel",
"grpc_resolver_fake",
"grpc_secure",
"grpc_transport_chttp2_client_secure",
],
)

@ -12,7 +12,7 @@ gRPC C++ - Building from source
If you plan to build from source and run tests, install the following as well:
```sh
$ [sudo] apt-get install libgflags-dev libgtest-dev
$ [sudo] apt-get install clang libc++-dev
$ [sudo] apt-get install clang-5.0 libc++-dev
```
Lastly, see the Protoc section below if you do not yet have the protoc compiler installed.

@ -96,8 +96,6 @@ endif()
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
add_definitions(-DPB_FIELD_32BIT)
if (MSVC)
include(cmake/msvc_static_runtime.cmake)
add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)

@ -354,7 +354,7 @@ CXXFLAGS += -stdlib=libc++
LDFLAGS += -framework CoreFoundation
endif
CXXFLAGS += -Wnon-virtual-dtor
CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated
CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated
COREFLAGS += -fno-rtti -fno-exceptions
LDFLAGS += -g
@ -451,7 +451,7 @@ USE_BUILT_PROTOC = false
endif
GTEST_LIB = -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googletest third_party/googletest/googletest/src/gtest-all.cc -Ithird_party/googletest/googlemock/include -Ithird_party/googletest/googlemock third_party/googletest/googlemock/src/gmock-all.cc
GTEST_LIB += -lgflags
GTEST_LIB += -lgflags -std=c++11
ifeq ($(V),1)
E = @:
Q =

@ -105,6 +105,7 @@ task 'dlls' do
env_comp = "CC=#{opt[:cross]}-gcc "
env_comp += "CXX=#{opt[:cross]}-g++ "
env_comp += "LD=#{opt[:cross]}-gcc "
env_comp += "LDXX=#{opt[:cross]}-g++ "
docker_for_windows "gem update --system --no-document && #{env} #{env_comp} make -j #{out} && #{opt[:cross]}-strip -x -S #{out} && cp #{out} #{opt[:out]}"
end

@ -99,6 +99,9 @@ def grpc_cc_library(
"//:grpc_allow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=1"],
"//:grpc_disallow_exceptions": ["GRPC_ALLOW_EXCEPTIONS=0"],
"//conditions:default": [],
}) + select({
"//:grpc_use_cpp_std_lib": ["GRPC_USE_CPP_STD_LIB=1"],
"//conditions:default": [],
}),
hdrs = hdrs + public_hdrs,
deps = deps + _get_external_deps(external_deps),

@ -62,7 +62,7 @@ def grpc_deps():
name = "gtest",
actual = "@com_github_google_googletest//:gtest",
)
native.bind(
name = "benchmark",
actual = "@com_github_google_benchmark//:benchmark",
@ -127,9 +127,17 @@ def grpc_deps():
if "com_github_google_googletest" not in native.existing_rules():
http_archive(
name = "com_github_google_googletest",
sha256 = "d0d447b4feeedca837a0d46a289d4223089b32ac2f84545fa4982755cc8919be",
strip_prefix = "googletest-2fe3bd994b3189899d93f1d5a881e725e046fdc2",
url = "https://github.com/google/googletest/archive/2fe3bd994b3189899d93f1d5a881e725e046fdc2.tar.gz",
sha256 = "443d383db648ebb8e391382c0ab63263b7091d03197f304390baac10f178a468",
strip_prefix = "googletest-c9ccac7cb7345901884aabf5d1a786cfa6e2f397",
url = "https://github.com/google/googletest/archive/c9ccac7cb7345901884aabf5d1a786cfa6e2f397.tar.gz", # 2019-08-19
)
if "rules_cc" not in native.existing_rules():
http_archive(
name = "rules_cc",
sha256 = "35f2fb4ea0b3e61ad64a369de284e4fbbdcdba71836a5555abb5e194cf119509",
strip_prefix = "rules_cc-624b5d59dfb45672d4239422fa1e3de1822ee110",
url = "https://github.com/bazelbuild/rules_cc/archive/624b5d59dfb45672d4239422fa1e3de1822ee110.tar.gz", #2019-08-15
)
if "com_github_gflags_gflags" not in native.existing_rules():

@ -61,22 +61,22 @@ _generate_pb2_src = rule(
def py_proto_library(
name,
srcs,
deps,
**kwargs):
"""Generate python code for a protobuf.
Args:
name: The name of the target.
srcs: A list of proto_library dependencies. Must contain a single element.
deps: A list of proto_library dependencies. Must contain a single element.
"""
codegen_target = "_{}_codegen".format(name)
if len(srcs) != 1:
if len(deps) != 1:
fail("Can only compile a single proto at a time.")
_generate_pb2_src(
name = codegen_target,
deps = srcs,
deps = deps,
**kwargs
)

@ -29,7 +29,7 @@ proto_library(
py_proto_library(
name = "helloworld_py_pb2",
srcs = [":helloworld_proto"],
deps = [":helloworld_proto"],
)
py_grpc_library(
@ -40,12 +40,12 @@ py_grpc_library(
py_proto_library(
name = "duration_py_pb2",
srcs = ["@com_google_protobuf//:duration_proto"],
deps = ["@com_google_protobuf//:duration_proto"],
)
py_proto_library(
name = "timestamp_py_pb2",
srcs = ["@com_google_protobuf//:timestamp_proto"],
deps = ["@com_google_protobuf//:timestamp_proto"],
)
py_test(

@ -6201,8 +6201,7 @@ defaults:
CPPFLAGS: -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long
-Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow
-Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers
-Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb
-Isrc/core/ext/upb-generated
-Wno-maybe-uninitialized -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated
CXXFLAGS: -Wnon-virtual-dtor
LDFLAGS: -g
zlib:

@ -14,8 +14,8 @@ if test "$PHP_GRPC" != "no"; then
LIBS="-lpthread $LIBS"
CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_32BIT=1"
CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_32BIT=1"
CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2"
CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2"
GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
PHP_REQUIRE_CXX()
PHP_ADD_LIBRARY(pthread)

@ -706,7 +706,6 @@ if (PHP_GRPC != "no") {
EXTENSION("grpc", grpc_source, null,
"/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+
"/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+
"/DPB_FIELD_32BIT "+
"/I"+configure_module_dirname+" "+
"/I"+configure_module_dirname+"\\include "+
"/I"+configure_module_dirname+"\\src\\core\\ext\\upb-generated "+

@ -67,7 +67,7 @@ proto_library(
py_proto_library(
name = "helloworld_py_pb2",
srcs = [":protos/helloworld_proto"],
deps = [":protos/helloworld_proto"],
)
py_grpc_library(

@ -26,7 +26,7 @@ proto_library(
py_proto_library(
name = "hash_name_py_pb2",
srcs = [":hash_name_proto"],
deps = [":hash_name_proto"],
)
py_grpc_library(

@ -23,7 +23,7 @@ proto_library(
py_proto_library(
name = "prime_proto_pb2",
srcs = [":prime_proto"],
deps = [":prime_proto"],
)
py_grpc_library(

@ -56,7 +56,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(PODS_TARGET_SRCROOT)/include"',
'USER_HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)"',
'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"',
'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"',
'CLANG_WARN_STRICT_PROTOTYPES' => 'NO',
'CLANG_WARN_DOCUMENTATION_COMMENTS' => 'NO',

@ -91,12 +91,12 @@ Pod::Spec.new do |s|
# build.
'USE_HEADERMAP' => 'NO',
'ALWAYS_SEARCH_USER_PATHS' => 'NO',
'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"',
'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"',
'CLANG_WARN_STRICT_PROTOTYPES' => 'NO',
}
s.default_subspecs = 'Interface', 'Implementation'
s.compiler_flags = '-DGRPC_ARES=0', '-DPB_FIELD_32BIT'
s.compiler_flags = '-DGRPC_ARES=0'
s.libraries = 'c++'
# Like many other C libraries, gRPC-Core has its public headers under `include/<libname>/` and its

@ -66,7 +66,6 @@
'-Wno-sign-compare',
'-Wno-missing-field-initializers',
'-Wno-maybe-uninitialized',
'-DPB_FIELD_32BIT',
'-DOSATOMIC_USE_INLINED=1',
'-Ithird_party/upb',
'-Isrc/core/ext/upb-generated',
@ -155,7 +154,6 @@
'-Wno-sign-compare',
'-Wno-missing-field-initializers',
'-Wno-maybe-uninitialized',
'-DPB_FIELD_32BIT',
'-DOSATOMIC_USE_INLINED=1',
'-Ithird_party/upb',
'-Isrc/core/ext/upb-generated',
@ -176,7 +174,6 @@
'-Wno-sign-compare',
'-Wno-missing-field-initializers',
'-Wno-maybe-uninitialized',
'-DPB_FIELD_32BIT',
'-DOSATOMIC_USE_INLINED=1',
'-Ithird_party/upb',
'-Isrc/core/ext/upb-generated',

@ -27,6 +27,15 @@
* - some syscalls to be made directly
*/
/*
* Defines GRPC_USE_CPP_STD_LIB to use standard C++ library instead of
* in-house library if possible. (e.g. std::map)
*/
#ifndef GRPC_USE_CPP_STD_LIB
/* Default value will be 1 once all tests become green. */
#define GRPC_USE_CPP_STD_LIB 0
#endif
/* Get windows.h included everywhere (we need it) */
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
#ifndef WIN32_LEAN_AND_MEAN

@ -161,7 +161,6 @@ if EXTRA_ENV_COMPILE_ARGS is None:
EXTRA_ENV_COMPILE_ARGS += ' -std=gnu99 -fvisibility=hidden -fno-wrapv -fno-exceptions'
elif "darwin" in sys.platform:
EXTRA_ENV_COMPILE_ARGS += ' -stdlib=libc++ -fvisibility=hidden -fno-wrapv -fno-exceptions'
EXTRA_ENV_COMPILE_ARGS += ' -DPB_FIELD_32BIT'
if EXTRA_ENV_LINK_ARGS is None:
EXTRA_ENV_LINK_ARGS = ''

@ -1318,11 +1318,6 @@ class ChannelData::ClientChannelControlHelper
chand_, subchannel, std::move(health_check_service_name));
}
grpc_channel* CreateChannel(const char* target,
const grpc_channel_args& args) override {
return chand_->client_channel_factory_->CreateChannel(target, &args);
}
void UpdateState(
grpc_connectivity_state state,
UniquePtr<LoadBalancingPolicy::SubchannelPicker> picker) override {
@ -1345,11 +1340,11 @@ class ChannelData::ClientChannelControlHelper
// No-op -- we should never get this from ResolvingLoadBalancingPolicy.
void RequestReresolution() override {}
void AddTraceEvent(TraceSeverity severity, const char* message) override {
void AddTraceEvent(TraceSeverity severity, StringView message) override {
if (chand_->channelz_node_ != nullptr) {
chand_->channelz_node_->AddTraceEvent(
ConvertSeverityEnum(severity),
grpc_slice_from_copied_string(message));
grpc_slice_from_copied_buffer(message.data(), message.size()));
}
}
@ -3168,8 +3163,8 @@ void CallData::AddRetriableSendInitialMetadataOp(
SubchannelCallRetryState* retry_state,
SubchannelCallBatchData* batch_data) {
// Maps the number of retries to the corresponding metadata value slice.
static const grpc_slice* retry_count_strings[] = {
&GRPC_MDSTR_1, &GRPC_MDSTR_2, &GRPC_MDSTR_3, &GRPC_MDSTR_4};
const grpc_slice* retry_count_strings[] = {&GRPC_MDSTR_1, &GRPC_MDSTR_2,
&GRPC_MDSTR_3, &GRPC_MDSTR_4};
// We need to make a copy of the metadata batch for each attempt, since
// the filters in the subchannel stack may modify this batch, and we don't
// want those modifications to be passed forward to subsequent attempts.
@ -3730,8 +3725,8 @@ const char* PickResultTypeName(
return "COMPLETE";
case LoadBalancingPolicy::PickResult::PICK_QUEUE:
return "QUEUE";
case LoadBalancingPolicy::PickResult::PICK_TRANSIENT_FAILURE:
return "TRANSIENT_FAILURE";
case LoadBalancingPolicy::PickResult::PICK_FAILED:
return "FAILED";
}
GPR_UNREACHABLE_CODE(return "UNKNOWN");
}
@ -3792,7 +3787,7 @@ void CallData::StartPickLocked(void* arg, grpc_error* error) {
result.subchannel.get(), grpc_error_string(result.error));
}
switch (result.type) {
case LoadBalancingPolicy::PickResult::PICK_TRANSIENT_FAILURE: {
case LoadBalancingPolicy::PickResult::PICK_FAILED: {
// If we're shutting down, fail all RPCs.
grpc_error* disconnect_error = chand->disconnect_error();
if (disconnect_error != GRPC_ERROR_NONE) {

@ -36,10 +36,6 @@ class ClientChannelFactory {
virtual Subchannel* CreateSubchannel(const grpc_channel_args* args)
GRPC_ABSTRACT;
// Creates a channel for the specified target with the specified args.
virtual grpc_channel* CreateChannel(
const char* target, const grpc_channel_args* args) GRPC_ABSTRACT;
// Returns a channel arg containing the specified factory.
static grpc_arg CreateChannelArg(ClientChannelFactory* factory);

@ -47,10 +47,12 @@ static char* get_http_proxy_server(char** user_cred) {
char* proxy_name = nullptr;
char** authority_strs = nullptr;
size_t authority_nstrs;
/* Prefer using 'https_proxy'. Fallback on 'http_proxy' if it is not set. The
/* Prefer using 'grpc_proxy'. Fallback on 'http_proxy' if it is not set.
* Also prefer using 'https_proxy' with fallback on 'http_proxy'. The
* fallback behavior can be removed if there's a demand for it.
*/
char* uri_str = gpr_getenv("https_proxy");
char* uri_str = gpr_getenv("grpc_proxy");
if (uri_str == nullptr) uri_str = gpr_getenv("https_proxy");
if (uri_str == nullptr) uri_str = gpr_getenv("http_proxy");
if (uri_str == nullptr) return nullptr;
grpc_uri* uri = grpc_uri_parse(uri_str, false /* suppress_errors */);
@ -122,7 +124,9 @@ static bool proxy_mapper_map_name(grpc_proxy_mapper* mapper,
server_uri);
goto no_use_proxy;
}
no_proxy_str = gpr_getenv("no_proxy");
/* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */
no_proxy_str = gpr_getenv("no_grpc_proxy");
if (no_proxy_str == nullptr) no_proxy_str = gpr_getenv("no_proxy");
if (no_proxy_str != nullptr) {
static const char* NO_PROXY_SEPARATOR = ",";
bool use_proxy = true;

@ -129,7 +129,7 @@ void LoadBalancingPolicy::QueuePicker::CallExitIdle(void* arg,
LoadBalancingPolicy::PickResult
LoadBalancingPolicy::TransientFailurePicker::Pick(PickArgs args) {
PickResult result;
result.type = PickResult::PICK_TRANSIENT_FAILURE;
result.type = PickResult::PICK_FAILED;
result.error = GRPC_ERROR_REF(error_);
return result;
}

@ -42,15 +42,15 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount;
///
/// Channel: An abstraction that manages connections to backend servers
/// on behalf of a client application. The application creates a channel
/// for a given server name and then sends RPCs on it, and the channel
/// figures out which backend server to send each RPC to. A channel
/// for a given server name and then sends calls (RPCs) on it, and the
/// channel figures out which backend server to send each call to. A channel
/// contains a resolver, a load balancing policy (or a tree of LB policies),
/// and a set of one or more subchannels.
///
/// Subchannel: A subchannel represents a connection to one backend server.
/// The LB policy decides which subchannels to create, manages the
/// connectivity state of those subchannels, and decides which subchannel
/// to send any given RPC to.
/// to send any given call to.
///
/// Resolver: A plugin that takes a gRPC server URI and resolves it to a
/// list of one or more addresses and a service config, as described
@ -59,12 +59,12 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount;
///
/// Load Balancing (LB) Policy: A plugin that takes a list of addresses
/// from the resolver, maintains and manages a subchannel for each
/// backend address, and decides which subchannel to send each RPC on.
/// backend address, and decides which subchannel to send each call on.
/// An LB policy has two parts:
/// - A LoadBalancingPolicy, which deals with the control plane work of
/// managing subchannels.
/// - A SubchannelPicker, which handles the data plane work of
/// determining which subchannel a given RPC should be sent on.
/// determining which subchannel a given call should be sent on.
/// LoadBalacingPolicy API.
///
@ -78,6 +78,7 @@ extern DebugOnlyTraceFlag grpc_trace_lb_policy_refcount;
class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
public:
/// Interface for accessing per-call state.
/// Implemented by the client channel and used by the SubchannelPicker.
class CallState {
public:
CallState() = default;
@ -93,6 +94,7 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
};
/// Interface for accessing metadata.
/// Implemented by the client channel and used by the SubchannelPicker.
class MetadataInterface {
public:
// Implementations whose iterators fit in intptr_t may internally
@ -123,7 +125,7 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
GRPC_ABSTRACT_BASE_CLASS
};
/// Arguments used when picking a subchannel for an RPC.
/// Arguments used when picking a subchannel for a call.
struct PickArgs {
/// Initial metadata associated with the picking call.
/// The LB policy may use the existing metadata to influence its routing
@ -135,24 +137,23 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
CallState* call_state;
};
/// The result of picking a subchannel for an RPC.
/// The result of picking a subchannel for a call.
struct PickResult {
enum ResultType {
/// Pick complete. If connected_subchannel is non-null, client channel
/// can immediately proceed with the call on connected_subchannel;
/// otherwise, call should be dropped.
/// Pick complete. If \a subchannel is non-null, the client channel
/// will immediately proceed with the call on that subchannel;
/// otherwise, it will drop the call.
PICK_COMPLETE,
/// Pick cannot be completed until something changes on the control
/// plane. Client channel will queue the pick and try again the
/// plane. The client channel will queue the pick and try again the
/// next time the picker is updated.
PICK_QUEUE,
/// LB policy is in transient failure. If the pick is wait_for_ready,
/// client channel will wait for the next picker and try again;
/// otherwise, the call will be failed immediately (although it may
/// be retried if the client channel is configured to do so).
/// The Pick() method will set its error parameter if this value is
/// returned.
PICK_TRANSIENT_FAILURE,
/// Pick failed. If the call is wait_for_ready, the client channel
/// will wait for the next picker and try again; otherwise, it
/// will immediately fail the call with the status indicated via
/// \a error (although the call may be retried if the client channel
/// is configured to do so).
PICK_FAILED,
};
ResultType type;
@ -160,14 +161,14 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
/// subchannel, or nullptr if the LB policy decides to drop the call.
RefCountedPtr<SubchannelInterface> subchannel;
/// Used only if type is PICK_TRANSIENT_FAILURE.
/// Error to be set when returning a transient failure.
/// Used only if type is PICK_FAILED.
/// Error to be set when returning a failure.
// TODO(roth): Replace this with something similar to grpc::Status,
// so that we don't expose grpc_error to this API.
grpc_error* error = GRPC_ERROR_NONE;
/// Used only if type is PICK_COMPLETE.
/// Callback set by lb policy to be notified of trailing metadata.
/// Callback set by LB policy to be notified of trailing metadata.
/// The user_data argument will be set to the
/// recv_trailing_metadata_ready_user_data field.
/// recv_trailing_metadata will be set to the metadata, which may be
@ -184,11 +185,12 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
};
/// A subchannel picker is the object used to pick the subchannel to
/// use for a given RPC.
/// use for a given call. This is implemented by the LB policy and
/// used by the client channel to perform picks.
///
/// Pickers are intended to encapsulate all of the state and logic
/// needed on the data plane (i.e., to actually process picks for
/// individual RPCs sent on the channel) while excluding all of the
/// individual calls sent on the channel) while excluding all of the
/// state and logic needed on the control plane (i.e., resolver
/// updates, connectivity state notifications, etc); the latter should
/// live in the LB policy object itself.
@ -206,8 +208,8 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
GRPC_ABSTRACT_BASE_CLASS
};
/// A proxy object used by the LB policy to communicate with the client
/// channel.
/// A proxy object implemented by the client channel and used by the
/// LB policy to communicate with the channel.
// TODO(juanlishen): Consider adding a mid-layer subclass that helps handle
// things like swapping in pending policy when it's ready. Currently, we are
// duplicating the logic in many subclasses.
@ -220,12 +222,6 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
virtual RefCountedPtr<SubchannelInterface> CreateSubchannel(
const grpc_channel_args& args) GRPC_ABSTRACT;
/// Creates a channel with the specified target and channel args.
/// This can be used in cases where the LB policy needs to create a
/// channel for its own use (e.g., to talk to an external load balancer).
virtual grpc_channel* CreateChannel(
const char* target, const grpc_channel_args& args) GRPC_ABSTRACT;
/// Sets the connectivity state and returns a new picker to be used
/// by the client channel.
virtual void UpdateState(grpc_connectivity_state state,
@ -235,10 +231,9 @@ class LoadBalancingPolicy : public InternallyRefCounted<LoadBalancingPolicy> {
virtual void RequestReresolution() GRPC_ABSTRACT;
/// Adds a trace message associated with the channel.
/// Does NOT take ownership of \a message.
enum TraceSeverity { TRACE_INFO, TRACE_WARNING, TRACE_ERROR };
virtual void AddTraceEvent(TraceSeverity severity,
const char* message) GRPC_ABSTRACT;
StringView message) GRPC_ABSTRACT;
GRPC_ABSTRACT_BASE_CLASS
};

@ -293,12 +293,10 @@ class GrpcLb : public LoadBalancingPolicy {
RefCountedPtr<SubchannelInterface> CreateSubchannel(
const grpc_channel_args& args) override;
grpc_channel* CreateChannel(const char* target,
const grpc_channel_args& args) override;
void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) override;
void RequestReresolution() override;
void AddTraceEvent(TraceSeverity severity, const char* message) override;
void AddTraceEvent(TraceSeverity severity, StringView message) override;
void set_child(LoadBalancingPolicy* child) { child_ = child; }
@ -652,15 +650,6 @@ RefCountedPtr<SubchannelInterface> GrpcLb::Helper::CreateSubchannel(
return parent_->channel_control_helper()->CreateSubchannel(args);
}
grpc_channel* GrpcLb::Helper::CreateChannel(const char* target,
const grpc_channel_args& args) {
if (parent_->shutting_down_ ||
(!CalledByPendingChild() && !CalledByCurrentChild())) {
return nullptr;
}
return parent_->channel_control_helper()->CreateChannel(target, args);
}
void GrpcLb::Helper::UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) {
if (parent_->shutting_down_) return;
@ -756,8 +745,7 @@ void GrpcLb::Helper::RequestReresolution() {
}
}
void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity,
const char* message) {
void GrpcLb::Helper::AddTraceEvent(TraceSeverity severity, StringView message) {
if (parent_->shutting_down_ ||
(!CalledByPendingChild() && !CalledByCurrentChild())) {
return;
@ -1276,7 +1264,7 @@ grpc_channel_args* BuildBalancerChannelArgs(
// the LB channel.
GRPC_ARG_FAKE_RESOLVER_RESPONSE_GENERATOR,
// The LB channel should use the authority indicated by the target
// authority table (see \a grpc_lb_policy_grpclb_modify_lb_channel_args),
// authority table (see \a ModifyGrpclbBalancerChannelArgs),
// as opposed to the authority from the parent channel.
GRPC_ARG_DEFAULT_AUTHORITY,
// Just as for \a GRPC_ARG_DEFAULT_AUTHORITY, the LB channel should be
@ -1312,7 +1300,7 @@ grpc_channel_args* BuildBalancerChannelArgs(
args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add.data(),
args_to_add.size());
// Make any necessary modifications for security.
return grpc_lb_policy_grpclb_modify_lb_channel_args(addresses, new_args);
return ModifyGrpclbBalancerChannelArgs(addresses, new_args);
}
//
@ -1488,8 +1476,7 @@ void GrpcLb::ProcessAddressesAndChannelArgsLocked(
if (lb_channel_ == nullptr) {
char* uri_str;
gpr_asprintf(&uri_str, "fake:///%s", server_name_);
lb_channel_ =
channel_control_helper()->CreateChannel(uri_str, *lb_channel_args);
lb_channel_ = CreateGrpclbBalancerChannel(uri_str, *lb_channel_args);
GPR_ASSERT(lb_channel_ != nullptr);
gpr_free(uri_str);
}

@ -18,9 +18,20 @@
#include <grpc/support/port_platform.h>
#include <grpc/grpc.h>
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h"
grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args(
const grpc_core::ServerAddressList& addresses, grpc_channel_args* args) {
namespace grpc_core {
grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
const ServerAddressList& addresses, grpc_channel_args* args) {
return args;
}
grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri,
const grpc_channel_args& args) {
return grpc_insecure_channel_create(target_uri, &args, nullptr);
}
} // namespace grpc_core

@ -25,14 +25,21 @@
#include "src/core/ext/filters/client_channel/server_address.h"
namespace grpc_core {
/// Makes any necessary modifications to \a args for use in the grpclb
/// balancer channel.
///
/// Takes ownership of \a args.
///
/// Caller takes ownership of the returned args.
grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args(
const grpc_core::ServerAddressList& addresses, grpc_channel_args* args);
grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
const ServerAddressList& addresses, grpc_channel_args* args);
grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri,
const grpc_channel_args& args);
} // namespace grpc_core
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_GRPCLB_GRPCLB_CHANNEL_H \
*/

@ -22,6 +22,7 @@
#include <string.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
@ -35,6 +36,7 @@
#include "src/core/lib/slice/slice_internal.h"
namespace grpc_core {
namespace {
int BalancerNameCmp(const grpc_core::UniquePtr<char>& a,
@ -65,37 +67,53 @@ RefCountedPtr<TargetAuthorityTable> CreateTargetAuthorityTable(
}
} // namespace
} // namespace grpc_core
grpc_channel_args* grpc_lb_policy_grpclb_modify_lb_channel_args(
const grpc_core::ServerAddressList& addresses, grpc_channel_args* args) {
const char* args_to_remove[1];
size_t num_args_to_remove = 0;
grpc_arg args_to_add[2];
size_t num_args_to_add = 0;
grpc_channel_args* ModifyGrpclbBalancerChannelArgs(
const ServerAddressList& addresses, grpc_channel_args* args) {
InlinedVector<const char*, 1> args_to_remove;
InlinedVector<grpc_arg, 2> args_to_add;
// Add arg for targets info table.
grpc_core::RefCountedPtr<grpc_core::TargetAuthorityTable>
target_authority_table = grpc_core::CreateTargetAuthorityTable(addresses);
args_to_add[num_args_to_add++] =
grpc_core::CreateTargetAuthorityTableChannelArg(
target_authority_table.get());
RefCountedPtr<TargetAuthorityTable> target_authority_table =
CreateTargetAuthorityTable(addresses);
args_to_add.emplace_back(
CreateTargetAuthorityTableChannelArg(target_authority_table.get()));
// Substitute the channel credentials with a version without call
// credentials: the load balancer is not necessarily trusted to handle
// bearer token credentials.
grpc_channel_credentials* channel_credentials =
grpc_channel_credentials_find_in_args(args);
grpc_core::RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
if (channel_credentials != nullptr) {
creds_sans_call_creds =
channel_credentials->duplicate_without_call_credentials();
GPR_ASSERT(creds_sans_call_creds != nullptr);
args_to_remove[num_args_to_remove++] = GRPC_ARG_CHANNEL_CREDENTIALS;
args_to_add[num_args_to_add++] =
grpc_channel_credentials_to_arg(creds_sans_call_creds.get());
args_to_remove.emplace_back(GRPC_ARG_CHANNEL_CREDENTIALS);
args_to_add.emplace_back(
grpc_channel_credentials_to_arg(creds_sans_call_creds.get()));
}
grpc_channel_args* result = grpc_channel_args_copy_and_add_and_remove(
args, args_to_remove, num_args_to_remove, args_to_add, num_args_to_add);
args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(),
args_to_add.size());
// Clean up.
grpc_channel_args_destroy(args);
return result;
}
grpc_channel* CreateGrpclbBalancerChannel(const char* target_uri,
const grpc_channel_args& args) {
grpc_channel_credentials* creds =
grpc_channel_credentials_find_in_args(&args);
if (creds == nullptr) {
// Build with security but parent channel is insecure.
return grpc_insecure_channel_create(target_uri, &args, nullptr);
}
const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS;
grpc_channel_args* new_args =
grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1);
grpc_channel* channel =
grpc_secure_channel_create(creds, target_uri, new_args, nullptr);
grpc_channel_args_destroy(new_args);
return channel;
}
} // namespace grpc_core

@ -431,12 +431,10 @@ class XdsLb : public LoadBalancingPolicy {
RefCountedPtr<SubchannelInterface> CreateSubchannel(
const grpc_channel_args& args) override;
grpc_channel* CreateChannel(const char* target,
const grpc_channel_args& args) override;
void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) override;
void RequestReresolution() override;
void AddTraceEvent(TraceSeverity severity, const char* message) override;
void AddTraceEvent(TraceSeverity severity, StringView message) override;
void set_child(LoadBalancingPolicy* child) { child_ = child; }
@ -482,13 +480,10 @@ class XdsLb : public LoadBalancingPolicy {
RefCountedPtr<SubchannelInterface> CreateSubchannel(
const grpc_channel_args& args) override;
grpc_channel* CreateChannel(const char* target,
const grpc_channel_args& args) override;
void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) override;
void RequestReresolution() override;
void AddTraceEvent(TraceSeverity severity,
const char* message) override;
void AddTraceEvent(TraceSeverity severity, StringView message) override;
void set_child(LoadBalancingPolicy* child) { child_ = child; }
private:
@ -723,15 +718,6 @@ RefCountedPtr<SubchannelInterface> XdsLb::FallbackHelper::CreateSubchannel(
return parent_->channel_control_helper()->CreateSubchannel(args);
}
grpc_channel* XdsLb::FallbackHelper::CreateChannel(
const char* target, const grpc_channel_args& args) {
if (parent_->shutting_down_ ||
(!CalledByPendingFallback() && !CalledByCurrentFallback())) {
return nullptr;
}
return parent_->channel_control_helper()->CreateChannel(target, args);
}
void XdsLb::FallbackHelper::UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) {
if (parent_->shutting_down_) return;
@ -774,7 +760,7 @@ void XdsLb::FallbackHelper::RequestReresolution() {
}
void XdsLb::FallbackHelper::AddTraceEvent(TraceSeverity severity,
const char* message) {
StringView message) {
if (parent_->shutting_down_ ||
(!CalledByPendingFallback() && !CalledByCurrentFallback())) {
return;
@ -793,8 +779,7 @@ XdsLb::LbChannelState::LbChannelState(RefCountedPtr<XdsLb> xdslb_policy,
xdslb_policy_(std::move(xdslb_policy)) {
GRPC_CLOSURE_INIT(&on_connectivity_changed_, OnConnectivityChangedLocked,
this, grpc_combiner_scheduler(xdslb_policy_->combiner()));
channel_ = xdslb_policy_->channel_control_helper()->CreateChannel(
balancer_name, args);
channel_ = CreateXdsBalancerChannel(balancer_name, args);
GPR_ASSERT(channel_ != nullptr);
eds_calld_.reset(New<RetryableLbCall<EdsCallState>>(
Ref(DEBUG_LOCATION, "LbChannelState+eds")));
@ -1672,7 +1657,7 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) {
// factory will re-add this arg with the right value.
GRPC_ARG_SERVER_URI,
// The LB channel should use the authority indicated by the target
// authority table (see \a grpc_lb_policy_xds_modify_lb_channel_args),
// authority table (see \a ModifyXdsBalancerChannelArgs),
// as opposed to the authority from the parent channel.
GRPC_ARG_DEFAULT_AUTHORITY,
// Just as for \a GRPC_ARG_DEFAULT_AUTHORITY, the LB channel should be
@ -1703,7 +1688,7 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) {
args, args_to_remove, GPR_ARRAY_SIZE(args_to_remove), args_to_add.data(),
args_to_add.size());
// Make any necessary modifications for security.
return grpc_lb_policy_xds_modify_lb_channel_args(new_args);
return ModifyXdsBalancerChannelArgs(new_args);
}
//
@ -2440,15 +2425,6 @@ XdsLb::LocalityMap::LocalityEntry::Helper::CreateSubchannel(
return entry_->parent_->channel_control_helper()->CreateSubchannel(args);
}
grpc_channel* XdsLb::LocalityMap::LocalityEntry::Helper::CreateChannel(
const char* target, const grpc_channel_args& args) {
if (entry_->parent_->shutting_down_ ||
(!CalledByPendingChild() && !CalledByCurrentChild())) {
return nullptr;
}
return entry_->parent_->channel_control_helper()->CreateChannel(target, args);
}
void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState(
grpc_connectivity_state state, UniquePtr<SubchannelPicker> picker) {
if (entry_->parent_->shutting_down_) return;
@ -2510,7 +2486,7 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::RequestReresolution() {
}
void XdsLb::LocalityMap::LocalityEntry::Helper::AddTraceEvent(
TraceSeverity severity, const char* message) {
TraceSeverity severity, StringView message) {
if (entry_->parent_->shutting_down_ ||
(!CalledByPendingChild() && !CalledByCurrentChild())) {
return;

@ -18,9 +18,19 @@
#include <grpc/support/port_platform.h>
#include <grpc/grpc.h>
#include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h"
grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args(
grpc_channel_args* args) {
namespace grpc_core {
grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args) {
return args;
}
grpc_channel* CreateXdsBalancerChannel(const char* target_uri,
const grpc_channel_args& args) {
return grpc_insecure_channel_create(target_uri, &args, nullptr);
}
} // namespace grpc_core

@ -23,14 +23,20 @@
#include <grpc/impl/codegen/grpc_types.h>
namespace grpc_core {
/// Makes any necessary modifications to \a args for use in the xds
/// balancer channel.
///
/// Takes ownership of \a args.
///
/// Caller takes ownership of the returned args.
grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args(
grpc_channel_args* args);
grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args);
grpc_channel* CreateXdsBalancerChannel(const char* target_uri,
const grpc_channel_args& args);
} // namespace grpc_core
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_LB_POLICY_XDS_XDS_CHANNEL_H \
*/

@ -20,9 +20,11 @@
#include "src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h"
#include <string.h>
#include <grpc/grpc_security.h>
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <string.h>
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/client_channel/server_address.h"
@ -33,29 +35,48 @@
#include "src/core/lib/security/transport/target_authority_table.h"
#include "src/core/lib/slice/slice_internal.h"
grpc_channel_args* grpc_lb_policy_xds_modify_lb_channel_args(
grpc_channel_args* args) {
const char* args_to_remove[1];
size_t num_args_to_remove = 0;
grpc_arg args_to_add[2];
size_t num_args_to_add = 0;
namespace grpc_core {
grpc_channel_args* ModifyXdsBalancerChannelArgs(grpc_channel_args* args) {
InlinedVector<const char*, 1> args_to_remove;
InlinedVector<grpc_arg, 2> args_to_add;
// Substitute the channel credentials with a version without call
// credentials: the load balancer is not necessarily trusted to handle
// bearer token credentials.
grpc_channel_credentials* channel_credentials =
grpc_channel_credentials_find_in_args(args);
grpc_core::RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
RefCountedPtr<grpc_channel_credentials> creds_sans_call_creds;
if (channel_credentials != nullptr) {
creds_sans_call_creds =
channel_credentials->duplicate_without_call_credentials();
GPR_ASSERT(creds_sans_call_creds != nullptr);
args_to_remove[num_args_to_remove++] = GRPC_ARG_CHANNEL_CREDENTIALS;
args_to_add[num_args_to_add++] =
grpc_channel_credentials_to_arg(creds_sans_call_creds.get());
args_to_remove.emplace_back(GRPC_ARG_CHANNEL_CREDENTIALS);
args_to_add.emplace_back(
grpc_channel_credentials_to_arg(creds_sans_call_creds.get()));
}
grpc_channel_args* result = grpc_channel_args_copy_and_add_and_remove(
args, args_to_remove, num_args_to_remove, args_to_add, num_args_to_add);
args, args_to_remove.data(), args_to_remove.size(), args_to_add.data(),
args_to_add.size());
// Clean up.
grpc_channel_args_destroy(args);
return result;
}
grpc_channel* CreateXdsBalancerChannel(const char* target_uri,
const grpc_channel_args& args) {
grpc_channel_credentials* creds =
grpc_channel_credentials_find_in_args(&args);
if (creds == nullptr) {
// Build with security but parent channel is insecure.
return grpc_insecure_channel_create(target_uri, &args, nullptr);
}
const char* arg_to_remove = GRPC_ARG_CHANNEL_CREDENTIALS;
grpc_channel_args* new_args =
grpc_channel_args_copy_and_remove(&args, &arg_to_remove, 1);
grpc_channel* channel =
grpc_secure_channel_create(creds, target_uri, new_args, nullptr);
grpc_channel_args_destroy(new_args);
return channel;
}
} // namespace grpc_core

@ -143,7 +143,15 @@ XdsClientStats::Snapshot XdsClientStats::GetSnapshotAndReset() {
}
{
MutexLock lock(&dropped_requests_mu_);
#if GRPC_USE_CPP_STD_LIB
// This is a workaround for the case where some compilers cannot build
// move-assignment of map with non-copyable but movable key.
// https://stackoverflow.com/questions/36475497
std::swap(snapshot.dropped_requests, dropped_requests_);
dropped_requests_.clear();
#else
snapshot.dropped_requests = std::move(dropped_requests_);
#endif
}
return snapshot;
}

@ -315,7 +315,15 @@ grpc_slice XdsLrsRequestCreateAndEncode(const char* server_name) {
namespace {
void LocalityStatsPopulate(envoy_api_v2_endpoint_UpstreamLocalityStats* output,
#if GRPC_USE_CPP_STD_LIB
// TODO(veblush): Clean up this
// This is to address the difference between
// std::map and Map. #else block will be gone
// once using stdlib is enabled by default.
Pair<const RefCountedPtr<XdsLocalityName>,
#else
Pair<RefCountedPtr<XdsLocalityName>,
#endif
XdsClientStats::LocalityStats::Snapshot>& input,
upb_arena* arena) {
// Set sub_zone.

@ -37,7 +37,8 @@ struct XdsLocalityInfo {
// This comparator only compares the locality names.
struct Less {
bool operator()(const XdsLocalityInfo& lhs, const XdsLocalityInfo& rhs) {
bool operator()(const XdsLocalityInfo& lhs,
const XdsLocalityInfo& rhs) const {
return XdsLocalityName::Less()(lhs.locality_name, rhs.locality_name);
}
};

@ -113,13 +113,6 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper
return parent_->channel_control_helper()->CreateSubchannel(args);
}
grpc_channel* CreateChannel(const char* target,
const grpc_channel_args& args) override {
if (parent_->resolver_ == nullptr) return nullptr; // Shutting down.
if (!CalledByCurrentChild() && !CalledByPendingChild()) return nullptr;
return parent_->channel_control_helper()->CreateChannel(target, args);
}
void UpdateState(grpc_connectivity_state state,
UniquePtr<SubchannelPicker> picker) override {
if (parent_->resolver_ == nullptr) return; // Shutting down.
@ -160,6 +153,8 @@ class ResolvingLoadBalancingPolicy::ResolvingControlHelper
}
}
void AddTraceEvent(TraceSeverity severity, StringView message) override {}
void set_child(LoadBalancingPolicy* child) { child_ = child; }
private:
@ -433,7 +428,7 @@ void ResolvingLoadBalancingPolicy::ConcatenateAndAddChannelTraceLocked(
size_t len = 0;
UniquePtr<char> message(gpr_strvec_flatten(&v, &len));
channel_control_helper()->AddTraceEvent(ChannelControlHelper::TRACE_INFO,
message.get());
StringView(message.get()));
gpr_strvec_destroy(&v);
}
}

@ -22,6 +22,7 @@
#include <grpc/support/port_platform.h>
#include "opencensus/stats/stats.h"
#include "opencensus/tags/tag_key.h"
#include "src/cpp/server/load_reporter/constants.h"
@ -80,33 +81,33 @@ inline ::opencensus::stats::MeasureDouble MeasureOtherCallMetric() {
// Tags.
inline ::opencensus::stats::TagKey TagKeyToken() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyToken);
inline ::opencensus::tags::TagKey TagKeyToken() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyToken);
return token;
}
inline ::opencensus::stats::TagKey TagKeyHost() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyHost);
inline ::opencensus::tags::TagKey TagKeyHost() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyHost);
return token;
}
inline ::opencensus::stats::TagKey TagKeyUserId() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyUserId);
inline ::opencensus::tags::TagKey TagKeyUserId() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyUserId);
return token;
}
inline ::opencensus::stats::TagKey TagKeyStatus() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyStatus);
inline ::opencensus::tags::TagKey TagKeyStatus() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyStatus);
return token;
}
inline ::opencensus::stats::TagKey TagKeyMetricName() {
static const ::opencensus::stats::TagKey token =
opencensus::stats::TagKey::Register(kTagKeyMetricName);
inline ::opencensus::tags::TagKey TagKeyMetricName() {
static const ::opencensus::tags::TagKey token =
opencensus::tags::TagKey::Register(kTagKeyMetricName);
return token;
}

@ -46,27 +46,30 @@ class Chttp2InsecureClientChannelFactory : public ClientChannelFactory {
grpc_channel_args_destroy(new_args);
return s;
}
};
grpc_channel* CreateChannel(const char* target,
const grpc_channel_args* args) override {
if (target == nullptr) {
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
return nullptr;
}
// Add channel arg containing the server URI.
UniquePtr<char> canonical_target =
ResolverRegistry::AddDefaultPrefixIfNeeded(target);
grpc_arg arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
grpc_channel* channel =
grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
grpc_channel_args_destroy(new_args);
return channel;
namespace {
grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args) {
if (target == nullptr) {
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
return nullptr;
}
};
// Add channel arg containing the server URI.
UniquePtr<char> canonical_target =
ResolverRegistry::AddDefaultPrefixIfNeeded(target);
grpc_arg arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
grpc_channel* channel =
grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
grpc_channel_args_destroy(new_args);
return channel;
}
} // namespace
} // namespace grpc_core
@ -98,7 +101,7 @@ grpc_channel* grpc_insecure_channel_create(const char* target,
grpc_arg arg = grpc_core::ClientChannelFactory::CreateChannelArg(g_factory);
grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
// Create channel.
grpc_channel* channel = g_factory->CreateChannel(target, new_args);
grpc_channel* channel = grpc_core::CreateChannel(target, new_args);
// Clean up.
grpc_channel_args_destroy(new_args);
return channel != nullptr ? channel

@ -58,26 +58,6 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
return s;
}
grpc_channel* CreateChannel(const char* target,
const grpc_channel_args* args) override {
if (target == nullptr) {
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
return nullptr;
}
// Add channel arg containing the server URI.
UniquePtr<char> canonical_target =
ResolverRegistry::AddDefaultPrefixIfNeeded(target);
grpc_arg arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
grpc_channel* channel =
grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
grpc_channel_args_destroy(new_args);
return channel;
}
private:
static grpc_channel_args* GetSecureNamingChannelArgs(
const grpc_channel_args* args) {
@ -170,6 +150,29 @@ class Chttp2SecureClientChannelFactory : public ClientChannelFactory {
}
};
namespace {
grpc_channel* CreateChannel(const char* target, const grpc_channel_args* args) {
if (target == nullptr) {
gpr_log(GPR_ERROR, "cannot create channel with NULL target name");
return nullptr;
}
// Add channel arg containing the server URI.
UniquePtr<char> canonical_target =
ResolverRegistry::AddDefaultPrefixIfNeeded(target);
grpc_arg arg = grpc_channel_arg_string_create(
const_cast<char*>(GRPC_ARG_SERVER_URI), canonical_target.get());
const char* to_remove[] = {GRPC_ARG_SERVER_URI};
grpc_channel_args* new_args =
grpc_channel_args_copy_and_add_and_remove(args, to_remove, 1, &arg, 1);
grpc_channel* channel =
grpc_channel_create(target, new_args, GRPC_CLIENT_CHANNEL, nullptr);
grpc_channel_args_destroy(new_args);
return channel;
}
} // namespace
} // namespace grpc_core
namespace {
@ -209,7 +212,7 @@ grpc_channel* grpc_secure_channel_create(grpc_channel_credentials* creds,
args, args_to_add, GPR_ARRAY_SIZE(args_to_add));
new_args = creds->update_arguments(new_args);
// Create channel.
channel = g_factory->CreateChannel(target, new_args);
channel = grpc_core::CreateChannel(target, new_args);
// Clean up.
grpc_channel_args_destroy(new_args);
}

@ -2465,6 +2465,13 @@ static void cancel_stream_cb(void* user_data, uint32_t key, void* stream) {
}
static void end_all_the_calls(grpc_chttp2_transport* t, grpc_error* error) {
intptr_t http2_error;
// If there is no explicit grpc or HTTP/2 error, set to UNAVAILABLE on server.
if (!t->is_client && !grpc_error_has_clear_grpc_status(error) &&
!grpc_error_get_int(error, GRPC_ERROR_INT_HTTP2_ERROR, &http2_error)) {
error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS,
GRPC_STATUS_UNAVAILABLE);
}
cancel_stream_cb_args args = {error, t};
grpc_chttp2_stream_map_for_each(&t->stream_map, cancel_stream_cb, &args);
GRPC_ERROR_UNREF(error);

@ -189,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 = grpc_static_mdelem_manifested[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));

@ -104,7 +104,7 @@ inline grpc_mdelem grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl* tbl,
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_static_mdelem_manifested()[index - 1]
: grpc_chttp2_hptbl_lookup_dynamic_index(tbl, index);
}
/* add a table entry to the index */
@ -120,7 +120,7 @@ size_t grpc_chttp2_get_size_in_hpack_table(grpc_mdelem elem,
inline uintptr_t grpc_chttp2_get_static_hpack_table_index(grpc_mdelem md) {
uintptr_t index =
reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(md)) -
grpc_static_mdelem_table;
grpc_static_mdelem_table();
if (index < GRPC_CHTTP2_LAST_STATIC_ENTRY) {
return index + 1; // Hpack static metadata element indices start at 1
}

@ -81,7 +81,10 @@ class BaseNode : public RefCounted<BaseNode> {
kSocket,
};
protected:
BaseNode(EntityType type, UniquePtr<char> name);
public:
virtual ~BaseNode();
// All children must implement this function.

@ -40,7 +40,7 @@
#include <time.h>
#include <unistd.h>
static long gettid(void) { return syscall(__NR_gettid); }
static long sys_gettid(void) { return syscall(__NR_gettid); }
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
@ -70,7 +70,7 @@ void gpr_default_log(gpr_log_func_args* args) {
gpr_timespec now = gpr_now(GPR_CLOCK_REALTIME);
struct tm tm;
static __thread long tid = 0;
if (tid == 0) tid = gettid();
if (tid == 0) tid = sys_gettid();
timer = static_cast<time_t>(now.tv_sec);
final_slash = strrchr(args->file, '/');

@ -31,7 +31,7 @@
#include <string.h>
#include <time.h>
static intptr_t gettid(void) { return (intptr_t)pthread_self(); }
static intptr_t sys_gettid(void) { return (intptr_t)pthread_self(); }
void gpr_log(const char* file, int line, gpr_log_severity severity,
const char* format, ...) {
@ -86,7 +86,7 @@ void gpr_default_log(gpr_log_func_args* args) {
char* prefix;
gpr_asprintf(&prefix, "%s%s.%09d %7" PRIdPTR " %s:%d]",
gpr_log_severity_string(args->severity), time_buffer,
(int)(now.tv_nsec), gettid(), display_file, args->line);
(int)(now.tv_nsec), sys_gettid(), display_file, args->line);
fprintf(stderr, "%-70s %s\n", prefix, args->message);
gpr_free(prefix);

@ -19,6 +19,14 @@
#ifndef GRPC_CORE_LIB_GPRPP_ABSTRACT_H
#define GRPC_CORE_LIB_GPRPP_ABSTRACT_H
#if GRPC_USE_CPP_STD_LIB
#define GRPC_ABSTRACT_BASE_CLASS
#define GRPC_ABSTRACT = 0
#else
// This is needed to support abstract base classes in the c core. Since gRPC
// doesn't have a c++ runtime, it will hit a linker error on delete unless
// we define a virtual operator delete. See this blog for more info:
@ -34,4 +42,6 @@
GPR_ASSERT(false); \
}
#endif // GRPC_USE_CPP_STD_LIB
#endif /* GRPC_CORE_LIB_GPRPP_ABSTRACT_H */

@ -27,12 +27,17 @@
#include <functional>
#include <iterator>
#if GRPC_USE_CPP_STD_LIB
#include <map>
#endif
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/pair.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
namespace grpc_core {
struct StringLess {
bool operator()(const char* a, const char* b) const {
return strcmp(a, b) < 0;
@ -50,6 +55,13 @@ struct RefCountedPtrLess {
}
};
#if GRPC_USE_CPP_STD_LIB
template <class Key, class T, class Compare = std::less<Key>>
using Map = std::map<Key, T, Compare>;
#else // GRPC_USE_CPP_STD_LIB
namespace testing {
class MapTest;
}
@ -63,6 +75,7 @@ class Map {
typedef Pair<key_type, mapped_type> value_type;
typedef Compare key_compare;
class iterator;
class const_iterator;
Map() = default;
~Map() { clear(); }
@ -83,6 +96,22 @@ class Map {
return *this;
}
// Copyable.
Map(const Map& other) {
for (const auto& p : other) {
emplace(p);
}
}
Map& operator=(const Map& other) {
if (this != &other) {
clear();
for (const auto& p : other) {
emplace(p);
}
}
return *this;
}
T& operator[](key_type&& key);
T& operator[](const key_type& key);
iterator find(const key_type& k);
@ -117,6 +146,13 @@ class Map {
iterator end() { return iterator(this, nullptr); }
const_iterator begin() const {
Entry* curr = GetMinEntry(root_);
return const_iterator(this, curr);
}
const_iterator end() const { return const_iterator(this, nullptr); }
iterator lower_bound(const Key& k) {
// This is a workaround for "const key_compare compare;"
// because some versions of compilers cannot build this by requiring
@ -209,6 +245,53 @@ class Map<Key, T, Compare>::iterator
GrpcMap* map_;
};
template <class Key, class T, class Compare>
class Map<Key, T, Compare>::const_iterator
: public std::iterator<std::input_iterator_tag, Pair<Key, T>, int32_t,
Pair<Key, T>*, Pair<Key, T>&> {
public:
const_iterator(const const_iterator& iter)
: curr_(iter.curr_), map_(iter.map_) {}
bool operator==(const const_iterator& rhs) const {
return (curr_ == rhs.curr_);
}
bool operator!=(const const_iterator& rhs) const {
return (curr_ != rhs.curr_);
}
const_iterator& operator++() {
curr_ = map_->InOrderSuccessor(curr_);
return *this;
}
const_iterator operator++(int) {
Entry* prev = curr_;
curr_ = map_->InOrderSuccessor(curr_);
return const_iterator(map_, prev);
}
const_iterator& operator=(const const_iterator& other) {
if (this != &other) {
this->curr_ = other.curr_;
this->map_ = other.map_;
}
return *this;
}
// operator*()
const value_type& operator*() const { return curr_->pair; }
// operator->()
const value_type* operator->() const { return &curr_->pair; }
private:
friend class Map<key_type, mapped_type, key_compare>;
using GrpcMap = typename ::grpc_core::Map<Key, T, Compare>;
const_iterator(const GrpcMap* map, Entry* curr) : curr_(curr), map_(map) {}
Entry* curr_;
const GrpcMap* map_;
};
template <class Key, class T, class Compare>
T& Map<Key, T, Compare>::operator[](key_type&& key) {
auto iter = find(key);
@ -466,5 +549,9 @@ int Map<Key, T, Compare>::CompareKeys(const key_type& lhs,
}
return left_comparison ? -1 : 1;
}
#endif // GRPC_USE_CPP_STD_LIB
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_GPRPP_MAP_H */

@ -1077,7 +1077,7 @@ static void end_worker(grpc_pollset* pollset, grpc_pollset_worker* worker,
}
#ifndef NDEBUG
static long gettid(void) { return syscall(__NR_gettid); }
static long sys_gettid(void) { return syscall(__NR_gettid); }
#endif
/* pollset->mu lock must be held by the caller before calling this.
@ -1097,7 +1097,7 @@ static grpc_error* pollset_work(grpc_pollset* pollset,
#define WORKER_PTR (&worker)
#endif
#ifndef NDEBUG
WORKER_PTR->originator = gettid();
WORKER_PTR->originator = sys_gettid();
#endif
if (GRPC_TRACE_FLAG_ENABLED(grpc_polling_trace)) {
gpr_log(GPR_INFO,

@ -392,7 +392,7 @@ static grpc_error* tcp_server_add_port(grpc_tcp_server* s,
socket->endpoint = nullptr;
socket->listener = nullptr;
socket->connector = nullptr;
grpc_custom_socket_vtable->init(socket, family);
error = grpc_custom_socket_vtable->init(socket, family);
if (error == GRPC_ERROR_NONE) {
error = add_socket_to_server(s, socket, addr, port_index, &sp);

@ -110,11 +110,17 @@ struct grpc_channel_credentials
create_security_connector(
grpc_core::RefCountedPtr<grpc_call_credentials> call_creds,
const char* target, const grpc_channel_args* args,
grpc_channel_args** new_args) {
grpc_channel_args** new_args)
#if GRPC_USE_CPP_STD_LIB
= 0;
#else
{
// Tell clang-tidy that call_creds cannot be passed as const-ref.
call_creds.reset();
GRPC_ABSTRACT;
gpr_log(GPR_ERROR, "Function marked GRPC_ABSTRACT was not implemented");
GPR_ASSERT(false);
}
#endif
// Creates a version of the channel credentials without any attached call
// credentials. This can be used in order to open a channel to a non-trusted

@ -138,11 +138,12 @@ grpc_slice grpc_slice_maybe_static_intern(grpc_slice slice,
for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) {
static_metadata_hash_ent ent =
static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)];
const grpc_core::StaticMetadataSlice* static_slice_table =
grpc_static_slice_table();
if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT &&
grpc_slice_eq_static_interned(slice,
grpc_static_slice_table[ent.idx])) {
grpc_slice_eq_static_interned(slice, static_slice_table[ent.idx])) {
*returned_slice_is_different = true;
return grpc_static_slice_table[ent.idx];
return static_slice_table[ent.idx];
}
}
@ -168,10 +169,11 @@ static const grpc_core::StaticMetadataSlice* MatchStaticSlice(
for (uint32_t i = 0; i <= max_static_metadata_hash_probe; i++) {
static_metadata_hash_ent ent =
static_metadata_hash[(hash + i) % GPR_ARRAY_SIZE(static_metadata_hash)];
const grpc_core::StaticMetadataSlice* static_slice_table =
grpc_static_slice_table();
if (ent.hash == hash && ent.idx < GRPC_STATIC_MDSTR_COUNT &&
grpc_static_slice_table[ent.idx].Equals(
std::forward<SliceArgs>(args)...)) {
return &grpc_static_slice_table[ent.idx];
static_slice_table[ent.idx].Equals(std::forward<SliceArgs>(args)...)) {
return &static_slice_table[ent.idx];
}
}
return nullptr;
@ -318,9 +320,11 @@ void grpc_slice_intern_init(void) {
static_metadata_hash[i].idx = GRPC_STATIC_MDSTR_COUNT;
}
max_static_metadata_hash_probe = 0;
const grpc_core::StaticMetadataSlice* static_slice_table =
grpc_static_slice_table();
for (size_t i = 0; i < GRPC_STATIC_MDSTR_COUNT; i++) {
grpc_static_metadata_hash_values[i] =
grpc_slice_default_hash_internal(grpc_static_slice_table[i]);
grpc_slice_default_hash_internal(static_slice_table[i]);
for (size_t j = 0; j < GPR_ARRAY_SIZE(static_metadata_hash); j++) {
size_t slot = (grpc_static_metadata_hash_values[i] + j) %
GPR_ARRAY_SIZE(static_metadata_hash);
@ -336,7 +340,7 @@ void grpc_slice_intern_init(void) {
}
// Handle KV hash for all static mdelems.
for (size_t i = 0; i < GRPC_STATIC_MDELEM_COUNT; ++i) {
grpc_static_mdelem_table[i].HashInit();
grpc_static_mdelem_table()[i].HashInit();
}
}

@ -182,7 +182,7 @@ struct StaticSliceRefcount {
index(index) {}
grpc_slice_refcount base;
uint32_t index;
const uint32_t index;
};
extern grpc_slice_refcount kNoopRefcount;

@ -108,7 +108,7 @@ struct ManagedMemorySlice : public grpc_slice {
return !grpc_slice_differs_refcounted(other, *this);
}
bool Equals(const char* buf, const size_t len) const {
return data.refcounted.length == len &&
return data.refcounted.length == len && buf != nullptr &&
memcmp(buf, data.refcounted.bytes, len) == 0;
}
};
@ -153,10 +153,14 @@ struct ExternallyManagedSlice : public UnmanagedMemorySlice {
};
struct StaticMetadataSlice : public ManagedMemorySlice {
StaticMetadataSlice(grpc_slice_refcount* ref, size_t length, uint8_t* bytes) {
StaticMetadataSlice(grpc_slice_refcount* ref, size_t length,
const uint8_t* bytes) {
refcount = ref;
data.refcounted.length = length;
data.refcounted.bytes = bytes;
// NB: grpc_slice may or may not point to a static slice, but we are
// definitely pointing to static data here. Since we are not changing
// the underlying C-type, we need a const_cast here.
data.refcounted.bytes = const_cast<uint8_t*>(bytes);
}
};

@ -134,6 +134,7 @@ void grpc_init(void) {
grpc_core::Fork::GlobalInit();
grpc_fork_handlers_auto_register();
grpc_stats_init();
grpc_init_static_metadata_ctx();
grpc_slice_intern_init();
grpc_mdctx_global_init();
grpc_channel_init_init();
@ -191,6 +192,8 @@ void grpc_shutdown_internal_locked(void) {
grpc_core::ApplicationCallbackExecCtx::GlobalShutdown();
g_shutting_down = false;
gpr_cv_broadcast(g_shutting_down_cv);
// Absolute last action will be to delete static metadata context.
grpc_destroy_static_metadata_ctx();
}
void grpc_shutdown_internal(void* ignored) {

@ -269,9 +269,9 @@ void grpc_mdctx_global_shutdown() {
#ifndef NDEBUG
static int is_mdelem_static(grpc_mdelem e) {
return reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(e)) >=
&grpc_static_mdelem_table[0] &&
&grpc_static_mdelem_table()[0] &&
reinterpret_cast<grpc_core::StaticMetadata*>(GRPC_MDELEM_DATA(e)) <
&grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
&grpc_static_mdelem_table()[GRPC_STATIC_MDELEM_COUNT];
}
#endif
@ -569,7 +569,7 @@ void* grpc_mdelem_get_user_data(grpc_mdelem md, void (*destroy_func)(void*)) {
grpc_static_mdelem_user_data
[reinterpret_cast<grpc_core::StaticMetadata*>(
GRPC_MDELEM_DATA(md)) -
grpc_static_mdelem_table]);
grpc_static_mdelem_table()]);
case GRPC_MDELEM_STORAGE_ALLOCATED: {
auto* am = reinterpret_cast<AllocatedMetadata*>(GRPC_MDELEM_DATA(md));
return get_user_data(am->user_data(), destroy_func);
@ -611,7 +611,7 @@ void* grpc_mdelem_set_user_data(grpc_mdelem md, void (*destroy_func)(void*),
grpc_static_mdelem_user_data
[reinterpret_cast<grpc_core::StaticMetadata*>(
GRPC_MDELEM_DATA(md)) -
grpc_static_mdelem_table]);
grpc_static_mdelem_table()]);
case GRPC_MDELEM_STORAGE_ALLOCATED: {
auto* am = reinterpret_cast<AllocatedMetadata*>(GRPC_MDELEM_DATA(md));
return set_user_data(am->user_data(), destroy_func, data);

File diff suppressed because it is too large Load Diff

@ -37,240 +37,262 @@ static_assert(
std::is_trivially_destructible<grpc_core::StaticMetadataSlice>::value,
"grpc_core::StaticMetadataSlice must be trivially destructible.");
#define GRPC_STATIC_MDSTR_COUNT 108
extern const grpc_core::StaticMetadataSlice
grpc_static_slice_table[GRPC_STATIC_MDSTR_COUNT];
void grpc_init_static_metadata_ctx(void);
void grpc_destroy_static_metadata_ctx(void);
namespace grpc_core {
#ifndef NDEBUG
constexpr uint64_t kGrpcStaticMetadataInitCanary = 0xCAFEF00DC0FFEE11L;
uint64_t StaticMetadataInitCanary();
#endif
extern const StaticMetadataSlice* g_static_metadata_slice_table;
}
inline const grpc_core::StaticMetadataSlice* grpc_static_slice_table() {
GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
grpc_core::kGrpcStaticMetadataInitCanary);
GPR_DEBUG_ASSERT(grpc_core::g_static_metadata_slice_table != nullptr);
return grpc_core::g_static_metadata_slice_table;
}
/* ":path" */
#define GRPC_MDSTR_PATH (grpc_static_slice_table[0])
#define GRPC_MDSTR_PATH (grpc_static_slice_table()[0])
/* ":method" */
#define GRPC_MDSTR_METHOD (grpc_static_slice_table[1])
#define GRPC_MDSTR_METHOD (grpc_static_slice_table()[1])
/* ":status" */
#define GRPC_MDSTR_STATUS (grpc_static_slice_table[2])
#define GRPC_MDSTR_STATUS (grpc_static_slice_table()[2])
/* ":authority" */
#define GRPC_MDSTR_AUTHORITY (grpc_static_slice_table[3])
#define GRPC_MDSTR_AUTHORITY (grpc_static_slice_table()[3])
/* ":scheme" */
#define GRPC_MDSTR_SCHEME (grpc_static_slice_table[4])
#define GRPC_MDSTR_SCHEME (grpc_static_slice_table()[4])
/* "te" */
#define GRPC_MDSTR_TE (grpc_static_slice_table[5])
#define GRPC_MDSTR_TE (grpc_static_slice_table()[5])
/* "grpc-message" */
#define GRPC_MDSTR_GRPC_MESSAGE (grpc_static_slice_table[6])
#define GRPC_MDSTR_GRPC_MESSAGE (grpc_static_slice_table()[6])
/* "grpc-status" */
#define GRPC_MDSTR_GRPC_STATUS (grpc_static_slice_table[7])
#define GRPC_MDSTR_GRPC_STATUS (grpc_static_slice_table()[7])
/* "grpc-payload-bin" */
#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (grpc_static_slice_table[8])
#define GRPC_MDSTR_GRPC_PAYLOAD_BIN (grpc_static_slice_table()[8])
/* "grpc-encoding" */
#define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table[9])
#define GRPC_MDSTR_GRPC_ENCODING (grpc_static_slice_table()[9])
/* "grpc-accept-encoding" */
#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table[10])
#define GRPC_MDSTR_GRPC_ACCEPT_ENCODING (grpc_static_slice_table()[10])
/* "grpc-server-stats-bin" */
#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN (grpc_static_slice_table[11])
#define GRPC_MDSTR_GRPC_SERVER_STATS_BIN (grpc_static_slice_table()[11])
/* "grpc-tags-bin" */
#define GRPC_MDSTR_GRPC_TAGS_BIN (grpc_static_slice_table[12])
#define GRPC_MDSTR_GRPC_TAGS_BIN (grpc_static_slice_table()[12])
/* "grpc-trace-bin" */
#define GRPC_MDSTR_GRPC_TRACE_BIN (grpc_static_slice_table[13])
#define GRPC_MDSTR_GRPC_TRACE_BIN (grpc_static_slice_table()[13])
/* "content-type" */
#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table[14])
#define GRPC_MDSTR_CONTENT_TYPE (grpc_static_slice_table()[14])
/* "content-encoding" */
#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table[15])
#define GRPC_MDSTR_CONTENT_ENCODING (grpc_static_slice_table()[15])
/* "accept-encoding" */
#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table[16])
#define GRPC_MDSTR_ACCEPT_ENCODING (grpc_static_slice_table()[16])
/* "grpc-internal-encoding-request" */
#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST (grpc_static_slice_table[17])
#define GRPC_MDSTR_GRPC_INTERNAL_ENCODING_REQUEST \
(grpc_static_slice_table()[17])
/* "grpc-internal-stream-encoding-request" */
#define GRPC_MDSTR_GRPC_INTERNAL_STREAM_ENCODING_REQUEST \
(grpc_static_slice_table[18])
(grpc_static_slice_table()[18])
/* "user-agent" */
#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table[19])
#define GRPC_MDSTR_USER_AGENT (grpc_static_slice_table()[19])
/* "host" */
#define GRPC_MDSTR_HOST (grpc_static_slice_table[20])
#define GRPC_MDSTR_HOST (grpc_static_slice_table()[20])
/* "grpc-previous-rpc-attempts" */
#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table[21])
#define GRPC_MDSTR_GRPC_PREVIOUS_RPC_ATTEMPTS (grpc_static_slice_table()[21])
/* "grpc-retry-pushback-ms" */
#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table[22])
#define GRPC_MDSTR_GRPC_RETRY_PUSHBACK_MS (grpc_static_slice_table()[22])
/* "grpc-timeout" */
#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table[23])
#define GRPC_MDSTR_GRPC_TIMEOUT (grpc_static_slice_table()[23])
/* "1" */
#define GRPC_MDSTR_1 (grpc_static_slice_table[24])
#define GRPC_MDSTR_1 (grpc_static_slice_table()[24])
/* "2" */
#define GRPC_MDSTR_2 (grpc_static_slice_table[25])
#define GRPC_MDSTR_2 (grpc_static_slice_table()[25])
/* "3" */
#define GRPC_MDSTR_3 (grpc_static_slice_table[26])
#define GRPC_MDSTR_3 (grpc_static_slice_table()[26])
/* "4" */
#define GRPC_MDSTR_4 (grpc_static_slice_table[27])
#define GRPC_MDSTR_4 (grpc_static_slice_table()[27])
/* "" */
#define GRPC_MDSTR_EMPTY (grpc_static_slice_table[28])
#define GRPC_MDSTR_EMPTY (grpc_static_slice_table()[28])
/* "grpc.wait_for_ready" */
#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table[29])
#define GRPC_MDSTR_GRPC_DOT_WAIT_FOR_READY (grpc_static_slice_table()[29])
/* "grpc.timeout" */
#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table[30])
#define GRPC_MDSTR_GRPC_DOT_TIMEOUT (grpc_static_slice_table()[30])
/* "grpc.max_request_message_bytes" */
#define GRPC_MDSTR_GRPC_DOT_MAX_REQUEST_MESSAGE_BYTES \
(grpc_static_slice_table[31])
(grpc_static_slice_table()[31])
/* "grpc.max_response_message_bytes" */
#define GRPC_MDSTR_GRPC_DOT_MAX_RESPONSE_MESSAGE_BYTES \
(grpc_static_slice_table[32])
(grpc_static_slice_table()[32])
/* "/grpc.lb.v1.LoadBalancer/BalanceLoad" */
#define GRPC_MDSTR_SLASH_GRPC_DOT_LB_DOT_V1_DOT_LOADBALANCER_SLASH_BALANCELOAD \
(grpc_static_slice_table[33])
(grpc_static_slice_table()[33])
/* "/envoy.service.load_stats.v2.LoadReportingService/StreamLoadStats" */
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_LOAD_STATS_DOT_V2_DOT_LOADREPORTINGSERVICE_SLASH_STREAMLOADSTATS \
(grpc_static_slice_table[34])
(grpc_static_slice_table()[34])
/* "/envoy.api.v2.EndpointDiscoveryService/StreamEndpoints" */
#define GRPC_MDSTR_SLASH_ENVOY_DOT_API_DOT_V2_DOT_ENDPOINTDISCOVERYSERVICE_SLASH_STREAMENDPOINTS \
(grpc_static_slice_table[35])
(grpc_static_slice_table()[35])
/* "/grpc.health.v1.Health/Watch" */
#define GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH \
(grpc_static_slice_table[36])
(grpc_static_slice_table()[36])
/* "/envoy.service.discovery.v2.AggregatedDiscoveryService/StreamAggregatedResources"
*/
#define GRPC_MDSTR_SLASH_ENVOY_DOT_SERVICE_DOT_DISCOVERY_DOT_V2_DOT_AGGREGATEDDISCOVERYSERVICE_SLASH_STREAMAGGREGATEDRESOURCES \
(grpc_static_slice_table[37])
(grpc_static_slice_table()[37])
/* "deflate" */
#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table[38])
#define GRPC_MDSTR_DEFLATE (grpc_static_slice_table()[38])
/* "gzip" */
#define GRPC_MDSTR_GZIP (grpc_static_slice_table[39])
#define GRPC_MDSTR_GZIP (grpc_static_slice_table()[39])
/* "stream/gzip" */
#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table[40])
#define GRPC_MDSTR_STREAM_SLASH_GZIP (grpc_static_slice_table()[40])
/* "GET" */
#define GRPC_MDSTR_GET (grpc_static_slice_table[41])
#define GRPC_MDSTR_GET (grpc_static_slice_table()[41])
/* "POST" */
#define GRPC_MDSTR_POST (grpc_static_slice_table[42])
#define GRPC_MDSTR_POST (grpc_static_slice_table()[42])
/* "/" */
#define GRPC_MDSTR_SLASH (grpc_static_slice_table[43])
#define GRPC_MDSTR_SLASH (grpc_static_slice_table()[43])
/* "/index.html" */
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table[44])
#define GRPC_MDSTR_SLASH_INDEX_DOT_HTML (grpc_static_slice_table()[44])
/* "http" */
#define GRPC_MDSTR_HTTP (grpc_static_slice_table[45])
#define GRPC_MDSTR_HTTP (grpc_static_slice_table()[45])
/* "https" */
#define GRPC_MDSTR_HTTPS (grpc_static_slice_table[46])
#define GRPC_MDSTR_HTTPS (grpc_static_slice_table()[46])
/* "200" */
#define GRPC_MDSTR_200 (grpc_static_slice_table[47])
#define GRPC_MDSTR_200 (grpc_static_slice_table()[47])
/* "204" */
#define GRPC_MDSTR_204 (grpc_static_slice_table[48])
#define GRPC_MDSTR_204 (grpc_static_slice_table()[48])
/* "206" */
#define GRPC_MDSTR_206 (grpc_static_slice_table[49])
#define GRPC_MDSTR_206 (grpc_static_slice_table()[49])
/* "304" */
#define GRPC_MDSTR_304 (grpc_static_slice_table[50])
#define GRPC_MDSTR_304 (grpc_static_slice_table()[50])
/* "400" */
#define GRPC_MDSTR_400 (grpc_static_slice_table[51])
#define GRPC_MDSTR_400 (grpc_static_slice_table()[51])
/* "404" */
#define GRPC_MDSTR_404 (grpc_static_slice_table[52])
#define GRPC_MDSTR_404 (grpc_static_slice_table()[52])
/* "500" */
#define GRPC_MDSTR_500 (grpc_static_slice_table[53])
#define GRPC_MDSTR_500 (grpc_static_slice_table()[53])
/* "accept-charset" */
#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table[54])
#define GRPC_MDSTR_ACCEPT_CHARSET (grpc_static_slice_table()[54])
/* "gzip, deflate" */
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table[55])
#define GRPC_MDSTR_GZIP_COMMA_DEFLATE (grpc_static_slice_table()[55])
/* "accept-language" */
#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table[56])
#define GRPC_MDSTR_ACCEPT_LANGUAGE (grpc_static_slice_table()[56])
/* "accept-ranges" */
#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table[57])
#define GRPC_MDSTR_ACCEPT_RANGES (grpc_static_slice_table()[57])
/* "accept" */
#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table[58])
#define GRPC_MDSTR_ACCEPT (grpc_static_slice_table()[58])
/* "access-control-allow-origin" */
#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table[59])
#define GRPC_MDSTR_ACCESS_CONTROL_ALLOW_ORIGIN (grpc_static_slice_table()[59])
/* "age" */
#define GRPC_MDSTR_AGE (grpc_static_slice_table[60])
#define GRPC_MDSTR_AGE (grpc_static_slice_table()[60])
/* "allow" */
#define GRPC_MDSTR_ALLOW (grpc_static_slice_table[61])
#define GRPC_MDSTR_ALLOW (grpc_static_slice_table()[61])
/* "authorization" */
#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table[62])
#define GRPC_MDSTR_AUTHORIZATION (grpc_static_slice_table()[62])
/* "cache-control" */
#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table[63])
#define GRPC_MDSTR_CACHE_CONTROL (grpc_static_slice_table()[63])
/* "content-disposition" */
#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table[64])
#define GRPC_MDSTR_CONTENT_DISPOSITION (grpc_static_slice_table()[64])
/* "content-language" */
#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table[65])
#define GRPC_MDSTR_CONTENT_LANGUAGE (grpc_static_slice_table()[65])
/* "content-length" */
#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table[66])
#define GRPC_MDSTR_CONTENT_LENGTH (grpc_static_slice_table()[66])
/* "content-location" */
#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table[67])
#define GRPC_MDSTR_CONTENT_LOCATION (grpc_static_slice_table()[67])
/* "content-range" */
#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table[68])
#define GRPC_MDSTR_CONTENT_RANGE (grpc_static_slice_table()[68])
/* "cookie" */
#define GRPC_MDSTR_COOKIE (grpc_static_slice_table[69])
#define GRPC_MDSTR_COOKIE (grpc_static_slice_table()[69])
/* "date" */
#define GRPC_MDSTR_DATE (grpc_static_slice_table[70])
#define GRPC_MDSTR_DATE (grpc_static_slice_table()[70])
/* "etag" */
#define GRPC_MDSTR_ETAG (grpc_static_slice_table[71])
#define GRPC_MDSTR_ETAG (grpc_static_slice_table()[71])
/* "expect" */
#define GRPC_MDSTR_EXPECT (grpc_static_slice_table[72])
#define GRPC_MDSTR_EXPECT (grpc_static_slice_table()[72])
/* "expires" */
#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table[73])
#define GRPC_MDSTR_EXPIRES (grpc_static_slice_table()[73])
/* "from" */
#define GRPC_MDSTR_FROM (grpc_static_slice_table[74])
#define GRPC_MDSTR_FROM (grpc_static_slice_table()[74])
/* "if-match" */
#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table[75])
#define GRPC_MDSTR_IF_MATCH (grpc_static_slice_table()[75])
/* "if-modified-since" */
#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table[76])
#define GRPC_MDSTR_IF_MODIFIED_SINCE (grpc_static_slice_table()[76])
/* "if-none-match" */
#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table[77])
#define GRPC_MDSTR_IF_NONE_MATCH (grpc_static_slice_table()[77])
/* "if-range" */
#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table[78])
#define GRPC_MDSTR_IF_RANGE (grpc_static_slice_table()[78])
/* "if-unmodified-since" */
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table[79])
#define GRPC_MDSTR_IF_UNMODIFIED_SINCE (grpc_static_slice_table()[79])
/* "last-modified" */
#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table[80])
#define GRPC_MDSTR_LAST_MODIFIED (grpc_static_slice_table()[80])
/* "link" */
#define GRPC_MDSTR_LINK (grpc_static_slice_table[81])
#define GRPC_MDSTR_LINK (grpc_static_slice_table()[81])
/* "location" */
#define GRPC_MDSTR_LOCATION (grpc_static_slice_table[82])
#define GRPC_MDSTR_LOCATION (grpc_static_slice_table()[82])
/* "max-forwards" */
#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table[83])
#define GRPC_MDSTR_MAX_FORWARDS (grpc_static_slice_table()[83])
/* "proxy-authenticate" */
#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table[84])
#define GRPC_MDSTR_PROXY_AUTHENTICATE (grpc_static_slice_table()[84])
/* "proxy-authorization" */
#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table[85])
#define GRPC_MDSTR_PROXY_AUTHORIZATION (grpc_static_slice_table()[85])
/* "range" */
#define GRPC_MDSTR_RANGE (grpc_static_slice_table[86])
#define GRPC_MDSTR_RANGE (grpc_static_slice_table()[86])
/* "referer" */
#define GRPC_MDSTR_REFERER (grpc_static_slice_table[87])
#define GRPC_MDSTR_REFERER (grpc_static_slice_table()[87])
/* "refresh" */
#define GRPC_MDSTR_REFRESH (grpc_static_slice_table[88])
#define GRPC_MDSTR_REFRESH (grpc_static_slice_table()[88])
/* "retry-after" */
#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table[89])
#define GRPC_MDSTR_RETRY_AFTER (grpc_static_slice_table()[89])
/* "server" */
#define GRPC_MDSTR_SERVER (grpc_static_slice_table[90])
#define GRPC_MDSTR_SERVER (grpc_static_slice_table()[90])
/* "set-cookie" */
#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table[91])
#define GRPC_MDSTR_SET_COOKIE (grpc_static_slice_table()[91])
/* "strict-transport-security" */
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table[92])
#define GRPC_MDSTR_STRICT_TRANSPORT_SECURITY (grpc_static_slice_table()[92])
/* "transfer-encoding" */
#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table[93])
#define GRPC_MDSTR_TRANSFER_ENCODING (grpc_static_slice_table()[93])
/* "vary" */
#define GRPC_MDSTR_VARY (grpc_static_slice_table[94])
#define GRPC_MDSTR_VARY (grpc_static_slice_table()[94])
/* "via" */
#define GRPC_MDSTR_VIA (grpc_static_slice_table[95])
#define GRPC_MDSTR_VIA (grpc_static_slice_table()[95])
/* "www-authenticate" */
#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table[96])
#define GRPC_MDSTR_WWW_AUTHENTICATE (grpc_static_slice_table()[96])
/* "0" */
#define GRPC_MDSTR_0 (grpc_static_slice_table[97])
#define GRPC_MDSTR_0 (grpc_static_slice_table()[97])
/* "identity" */
#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table[98])
#define GRPC_MDSTR_IDENTITY (grpc_static_slice_table()[98])
/* "trailers" */
#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table[99])
#define GRPC_MDSTR_TRAILERS (grpc_static_slice_table()[99])
/* "application/grpc" */
#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table[100])
#define GRPC_MDSTR_APPLICATION_SLASH_GRPC (grpc_static_slice_table()[100])
/* "grpc" */
#define GRPC_MDSTR_GRPC (grpc_static_slice_table[101])
#define GRPC_MDSTR_GRPC (grpc_static_slice_table()[101])
/* "PUT" */
#define GRPC_MDSTR_PUT (grpc_static_slice_table[102])
#define GRPC_MDSTR_PUT (grpc_static_slice_table()[102])
/* "lb-cost-bin" */
#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table[103])
#define GRPC_MDSTR_LB_COST_BIN (grpc_static_slice_table()[103])
/* "identity,deflate" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table[104])
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE (grpc_static_slice_table()[104])
/* "identity,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table[105])
#define GRPC_MDSTR_IDENTITY_COMMA_GZIP (grpc_static_slice_table()[105])
/* "deflate,gzip" */
#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table[106])
#define GRPC_MDSTR_DEFLATE_COMMA_GZIP (grpc_static_slice_table()[106])
/* "identity,deflate,gzip" */
#define GRPC_MDSTR_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(grpc_static_slice_table[107])
(grpc_static_slice_table()[107])
namespace grpc_core {
struct StaticSliceRefcount;
extern StaticSliceRefcount* g_static_metadata_slice_refcounts;
} // namespace grpc_core
inline grpc_core::StaticSliceRefcount* grpc_static_metadata_refcounts() {
GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
grpc_core::kGrpcStaticMetadataInitCanary);
GPR_DEBUG_ASSERT(grpc_core::g_static_metadata_slice_refcounts != nullptr);
return grpc_core::g_static_metadata_slice_refcounts;
}
extern grpc_core::StaticSliceRefcount
grpc_static_metadata_refcounts[GRPC_STATIC_MDSTR_COUNT];
#define GRPC_IS_STATIC_METADATA_STRING(slice) \
((slice).refcount != NULL && \
(slice).refcount->GetType() == grpc_slice_refcount::Type::STATIC)
@ -280,196 +302,216 @@ extern grpc_core::StaticSliceRefcount
->index)
#define GRPC_STATIC_MDELEM_COUNT 85
extern grpc_core::StaticMetadata
grpc_static_mdelem_table[GRPC_STATIC_MDELEM_COUNT];
namespace grpc_core {
extern StaticMetadata* g_static_mdelem_table;
extern grpc_mdelem* g_static_mdelem_manifested;
} // namespace grpc_core
inline grpc_core::StaticMetadata* grpc_static_mdelem_table() {
GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
grpc_core::kGrpcStaticMetadataInitCanary);
GPR_DEBUG_ASSERT(grpc_core::g_static_mdelem_table != nullptr);
return grpc_core::g_static_mdelem_table;
}
inline grpc_mdelem* grpc_static_mdelem_manifested() {
GPR_DEBUG_ASSERT(grpc_core::StaticMetadataInitCanary() ==
grpc_core::kGrpcStaticMetadataInitCanary);
GPR_DEBUG_ASSERT(grpc_core::g_static_mdelem_manifested != nullptr);
return grpc_core::g_static_mdelem_manifested;
}
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_static_mdelem_manifested[0])
#define GRPC_MDELEM_AUTHORITY_EMPTY (grpc_static_mdelem_manifested()[0])
/* ":method": "GET" */
#define GRPC_MDELEM_METHOD_GET (grpc_static_mdelem_manifested[1])
#define GRPC_MDELEM_METHOD_GET (grpc_static_mdelem_manifested()[1])
/* ":method": "POST" */
#define GRPC_MDELEM_METHOD_POST (grpc_static_mdelem_manifested[2])
#define GRPC_MDELEM_METHOD_POST (grpc_static_mdelem_manifested()[2])
/* ":path": "/" */
#define GRPC_MDELEM_PATH_SLASH (grpc_static_mdelem_manifested[3])
#define GRPC_MDELEM_PATH_SLASH (grpc_static_mdelem_manifested()[3])
/* ":path": "/index.html" */
#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML (grpc_static_mdelem_manifested[4])
#define GRPC_MDELEM_PATH_SLASH_INDEX_DOT_HTML \
(grpc_static_mdelem_manifested()[4])
/* ":scheme": "http" */
#define GRPC_MDELEM_SCHEME_HTTP (grpc_static_mdelem_manifested[5])
#define GRPC_MDELEM_SCHEME_HTTP (grpc_static_mdelem_manifested()[5])
/* ":scheme": "https" */
#define GRPC_MDELEM_SCHEME_HTTPS (grpc_static_mdelem_manifested[6])
#define GRPC_MDELEM_SCHEME_HTTPS (grpc_static_mdelem_manifested()[6])
/* ":status": "200" */
#define GRPC_MDELEM_STATUS_200 (grpc_static_mdelem_manifested[7])
#define GRPC_MDELEM_STATUS_200 (grpc_static_mdelem_manifested()[7])
/* ":status": "204" */
#define GRPC_MDELEM_STATUS_204 (grpc_static_mdelem_manifested[8])
#define GRPC_MDELEM_STATUS_204 (grpc_static_mdelem_manifested()[8])
/* ":status": "206" */
#define GRPC_MDELEM_STATUS_206 (grpc_static_mdelem_manifested[9])
#define GRPC_MDELEM_STATUS_206 (grpc_static_mdelem_manifested()[9])
/* ":status": "304" */
#define GRPC_MDELEM_STATUS_304 (grpc_static_mdelem_manifested[10])
#define GRPC_MDELEM_STATUS_304 (grpc_static_mdelem_manifested()[10])
/* ":status": "400" */
#define GRPC_MDELEM_STATUS_400 (grpc_static_mdelem_manifested[11])
#define GRPC_MDELEM_STATUS_400 (grpc_static_mdelem_manifested()[11])
/* ":status": "404" */
#define GRPC_MDELEM_STATUS_404 (grpc_static_mdelem_manifested[12])
#define GRPC_MDELEM_STATUS_404 (grpc_static_mdelem_manifested()[12])
/* ":status": "500" */
#define GRPC_MDELEM_STATUS_500 (grpc_static_mdelem_manifested[13])
#define GRPC_MDELEM_STATUS_500 (grpc_static_mdelem_manifested()[13])
/* "accept-charset": "" */
#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (grpc_static_mdelem_manifested[14])
#define GRPC_MDELEM_ACCEPT_CHARSET_EMPTY (grpc_static_mdelem_manifested()[14])
/* "accept-encoding": "gzip, deflate" */
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP_COMMA_DEFLATE \
(grpc_static_mdelem_manifested[15])
(grpc_static_mdelem_manifested()[15])
/* "accept-language": "" */
#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested[16])
#define GRPC_MDELEM_ACCEPT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested()[16])
/* "accept-ranges": "" */
#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (grpc_static_mdelem_manifested[17])
#define GRPC_MDELEM_ACCEPT_RANGES_EMPTY (grpc_static_mdelem_manifested()[17])
/* "accept": "" */
#define GRPC_MDELEM_ACCEPT_EMPTY (grpc_static_mdelem_manifested[18])
#define GRPC_MDELEM_ACCEPT_EMPTY (grpc_static_mdelem_manifested()[18])
/* "access-control-allow-origin": "" */
#define GRPC_MDELEM_ACCESS_CONTROL_ALLOW_ORIGIN_EMPTY \
(grpc_static_mdelem_manifested[19])
(grpc_static_mdelem_manifested()[19])
/* "age": "" */
#define GRPC_MDELEM_AGE_EMPTY (grpc_static_mdelem_manifested[20])
#define GRPC_MDELEM_AGE_EMPTY (grpc_static_mdelem_manifested()[20])
/* "allow": "" */
#define GRPC_MDELEM_ALLOW_EMPTY (grpc_static_mdelem_manifested[21])
#define GRPC_MDELEM_ALLOW_EMPTY (grpc_static_mdelem_manifested()[21])
/* "authorization": "" */
#define GRPC_MDELEM_AUTHORIZATION_EMPTY (grpc_static_mdelem_manifested[22])
#define GRPC_MDELEM_AUTHORIZATION_EMPTY (grpc_static_mdelem_manifested()[22])
/* "cache-control": "" */
#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (grpc_static_mdelem_manifested[23])
#define GRPC_MDELEM_CACHE_CONTROL_EMPTY (grpc_static_mdelem_manifested()[23])
/* "content-disposition": "" */
#define GRPC_MDELEM_CONTENT_DISPOSITION_EMPTY \
(grpc_static_mdelem_manifested[24])
(grpc_static_mdelem_manifested()[24])
/* "content-encoding": "" */
#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (grpc_static_mdelem_manifested[25])
#define GRPC_MDELEM_CONTENT_ENCODING_EMPTY (grpc_static_mdelem_manifested()[25])
/* "content-language": "" */
#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested[26])
#define GRPC_MDELEM_CONTENT_LANGUAGE_EMPTY (grpc_static_mdelem_manifested()[26])
/* "content-length": "" */
#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (grpc_static_mdelem_manifested[27])
#define GRPC_MDELEM_CONTENT_LENGTH_EMPTY (grpc_static_mdelem_manifested()[27])
/* "content-location": "" */
#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (grpc_static_mdelem_manifested[28])
#define GRPC_MDELEM_CONTENT_LOCATION_EMPTY (grpc_static_mdelem_manifested()[28])
/* "content-range": "" */
#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (grpc_static_mdelem_manifested[29])
#define GRPC_MDELEM_CONTENT_RANGE_EMPTY (grpc_static_mdelem_manifested()[29])
/* "content-type": "" */
#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (grpc_static_mdelem_manifested[30])
#define GRPC_MDELEM_CONTENT_TYPE_EMPTY (grpc_static_mdelem_manifested()[30])
/* "cookie": "" */
#define GRPC_MDELEM_COOKIE_EMPTY (grpc_static_mdelem_manifested[31])
#define GRPC_MDELEM_COOKIE_EMPTY (grpc_static_mdelem_manifested()[31])
/* "date": "" */
#define GRPC_MDELEM_DATE_EMPTY (grpc_static_mdelem_manifested[32])
#define GRPC_MDELEM_DATE_EMPTY (grpc_static_mdelem_manifested()[32])
/* "etag": "" */
#define GRPC_MDELEM_ETAG_EMPTY (grpc_static_mdelem_manifested[33])
#define GRPC_MDELEM_ETAG_EMPTY (grpc_static_mdelem_manifested()[33])
/* "expect": "" */
#define GRPC_MDELEM_EXPECT_EMPTY (grpc_static_mdelem_manifested[34])
#define GRPC_MDELEM_EXPECT_EMPTY (grpc_static_mdelem_manifested()[34])
/* "expires": "" */
#define GRPC_MDELEM_EXPIRES_EMPTY (grpc_static_mdelem_manifested[35])
#define GRPC_MDELEM_EXPIRES_EMPTY (grpc_static_mdelem_manifested()[35])
/* "from": "" */
#define GRPC_MDELEM_FROM_EMPTY (grpc_static_mdelem_manifested[36])
#define GRPC_MDELEM_FROM_EMPTY (grpc_static_mdelem_manifested()[36])
/* "host": "" */
#define GRPC_MDELEM_HOST_EMPTY (grpc_static_mdelem_manifested[37])
#define GRPC_MDELEM_HOST_EMPTY (grpc_static_mdelem_manifested()[37])
/* "if-match": "" */
#define GRPC_MDELEM_IF_MATCH_EMPTY (grpc_static_mdelem_manifested[38])
#define GRPC_MDELEM_IF_MATCH_EMPTY (grpc_static_mdelem_manifested()[38])
/* "if-modified-since": "" */
#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY (grpc_static_mdelem_manifested[39])
#define GRPC_MDELEM_IF_MODIFIED_SINCE_EMPTY \
(grpc_static_mdelem_manifested()[39])
/* "if-none-match": "" */
#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (grpc_static_mdelem_manifested[40])
#define GRPC_MDELEM_IF_NONE_MATCH_EMPTY (grpc_static_mdelem_manifested()[40])
/* "if-range": "" */
#define GRPC_MDELEM_IF_RANGE_EMPTY (grpc_static_mdelem_manifested[41])
#define GRPC_MDELEM_IF_RANGE_EMPTY (grpc_static_mdelem_manifested()[41])
/* "if-unmodified-since": "" */
#define GRPC_MDELEM_IF_UNMODIFIED_SINCE_EMPTY \
(grpc_static_mdelem_manifested[42])
(grpc_static_mdelem_manifested()[42])
/* "last-modified": "" */
#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (grpc_static_mdelem_manifested[43])
#define GRPC_MDELEM_LAST_MODIFIED_EMPTY (grpc_static_mdelem_manifested()[43])
/* "link": "" */
#define GRPC_MDELEM_LINK_EMPTY (grpc_static_mdelem_manifested[44])
#define GRPC_MDELEM_LINK_EMPTY (grpc_static_mdelem_manifested()[44])
/* "location": "" */
#define GRPC_MDELEM_LOCATION_EMPTY (grpc_static_mdelem_manifested[45])
#define GRPC_MDELEM_LOCATION_EMPTY (grpc_static_mdelem_manifested()[45])
/* "max-forwards": "" */
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (grpc_static_mdelem_manifested[46])
#define GRPC_MDELEM_MAX_FORWARDS_EMPTY (grpc_static_mdelem_manifested()[46])
/* "proxy-authenticate": "" */
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested[47])
#define GRPC_MDELEM_PROXY_AUTHENTICATE_EMPTY \
(grpc_static_mdelem_manifested()[47])
/* "proxy-authorization": "" */
#define GRPC_MDELEM_PROXY_AUTHORIZATION_EMPTY \
(grpc_static_mdelem_manifested[48])
(grpc_static_mdelem_manifested()[48])
/* "range": "" */
#define GRPC_MDELEM_RANGE_EMPTY (grpc_static_mdelem_manifested[49])
#define GRPC_MDELEM_RANGE_EMPTY (grpc_static_mdelem_manifested()[49])
/* "referer": "" */
#define GRPC_MDELEM_REFERER_EMPTY (grpc_static_mdelem_manifested[50])
#define GRPC_MDELEM_REFERER_EMPTY (grpc_static_mdelem_manifested()[50])
/* "refresh": "" */
#define GRPC_MDELEM_REFRESH_EMPTY (grpc_static_mdelem_manifested[51])
#define GRPC_MDELEM_REFRESH_EMPTY (grpc_static_mdelem_manifested()[51])
/* "retry-after": "" */
#define GRPC_MDELEM_RETRY_AFTER_EMPTY (grpc_static_mdelem_manifested[52])
#define GRPC_MDELEM_RETRY_AFTER_EMPTY (grpc_static_mdelem_manifested()[52])
/* "server": "" */
#define GRPC_MDELEM_SERVER_EMPTY (grpc_static_mdelem_manifested[53])
#define GRPC_MDELEM_SERVER_EMPTY (grpc_static_mdelem_manifested()[53])
/* "set-cookie": "" */
#define GRPC_MDELEM_SET_COOKIE_EMPTY (grpc_static_mdelem_manifested[54])
#define GRPC_MDELEM_SET_COOKIE_EMPTY (grpc_static_mdelem_manifested()[54])
/* "strict-transport-security": "" */
#define GRPC_MDELEM_STRICT_TRANSPORT_SECURITY_EMPTY \
(grpc_static_mdelem_manifested[55])
(grpc_static_mdelem_manifested()[55])
/* "transfer-encoding": "" */
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY (grpc_static_mdelem_manifested[56])
#define GRPC_MDELEM_TRANSFER_ENCODING_EMPTY \
(grpc_static_mdelem_manifested()[56])
/* "user-agent": "" */
#define GRPC_MDELEM_USER_AGENT_EMPTY (grpc_static_mdelem_manifested[57])
#define GRPC_MDELEM_USER_AGENT_EMPTY (grpc_static_mdelem_manifested()[57])
/* "vary": "" */
#define GRPC_MDELEM_VARY_EMPTY (grpc_static_mdelem_manifested[58])
#define GRPC_MDELEM_VARY_EMPTY (grpc_static_mdelem_manifested()[58])
/* "via": "" */
#define GRPC_MDELEM_VIA_EMPTY (grpc_static_mdelem_manifested[59])
#define GRPC_MDELEM_VIA_EMPTY (grpc_static_mdelem_manifested()[59])
/* "www-authenticate": "" */
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested[60])
#define GRPC_MDELEM_WWW_AUTHENTICATE_EMPTY (grpc_static_mdelem_manifested()[60])
/* "grpc-status": "0" */
#define GRPC_MDELEM_GRPC_STATUS_0 (grpc_static_mdelem_manifested[61])
#define GRPC_MDELEM_GRPC_STATUS_0 (grpc_static_mdelem_manifested()[61])
/* "grpc-status": "1" */
#define GRPC_MDELEM_GRPC_STATUS_1 (grpc_static_mdelem_manifested[62])
#define GRPC_MDELEM_GRPC_STATUS_1 (grpc_static_mdelem_manifested()[62])
/* "grpc-status": "2" */
#define GRPC_MDELEM_GRPC_STATUS_2 (grpc_static_mdelem_manifested[63])
#define GRPC_MDELEM_GRPC_STATUS_2 (grpc_static_mdelem_manifested()[63])
/* "grpc-encoding": "identity" */
#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY (grpc_static_mdelem_manifested[64])
#define GRPC_MDELEM_GRPC_ENCODING_IDENTITY (grpc_static_mdelem_manifested()[64])
/* "grpc-encoding": "gzip" */
#define GRPC_MDELEM_GRPC_ENCODING_GZIP (grpc_static_mdelem_manifested[65])
#define GRPC_MDELEM_GRPC_ENCODING_GZIP (grpc_static_mdelem_manifested()[65])
/* "grpc-encoding": "deflate" */
#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE (grpc_static_mdelem_manifested[66])
#define GRPC_MDELEM_GRPC_ENCODING_DEFLATE (grpc_static_mdelem_manifested()[66])
/* "te": "trailers" */
#define GRPC_MDELEM_TE_TRAILERS (grpc_static_mdelem_manifested[67])
#define GRPC_MDELEM_TE_TRAILERS (grpc_static_mdelem_manifested()[67])
/* "content-type": "application/grpc" */
#define GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC \
(grpc_static_mdelem_manifested[68])
(grpc_static_mdelem_manifested()[68])
/* ":scheme": "grpc" */
#define GRPC_MDELEM_SCHEME_GRPC (grpc_static_mdelem_manifested[69])
#define GRPC_MDELEM_SCHEME_GRPC (grpc_static_mdelem_manifested()[69])
/* ":method": "PUT" */
#define GRPC_MDELEM_METHOD_PUT (grpc_static_mdelem_manifested[70])
#define GRPC_MDELEM_METHOD_PUT (grpc_static_mdelem_manifested()[70])
/* "accept-encoding": "" */
#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY (grpc_static_mdelem_manifested[71])
#define GRPC_MDELEM_ACCEPT_ENCODING_EMPTY (grpc_static_mdelem_manifested()[71])
/* "content-encoding": "identity" */
#define GRPC_MDELEM_CONTENT_ENCODING_IDENTITY \
(grpc_static_mdelem_manifested[72])
(grpc_static_mdelem_manifested()[72])
/* "content-encoding": "gzip" */
#define GRPC_MDELEM_CONTENT_ENCODING_GZIP (grpc_static_mdelem_manifested[73])
#define GRPC_MDELEM_CONTENT_ENCODING_GZIP (grpc_static_mdelem_manifested()[73])
/* "lb-cost-bin": "" */
#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested[74])
#define GRPC_MDELEM_LB_COST_BIN_EMPTY (grpc_static_mdelem_manifested()[74])
/* "grpc-accept-encoding": "identity" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY \
(grpc_static_mdelem_manifested[75])
(grpc_static_mdelem_manifested()[75])
/* "grpc-accept-encoding": "deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE \
(grpc_static_mdelem_manifested[76])
(grpc_static_mdelem_manifested()[76])
/* "grpc-accept-encoding": "identity,deflate" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE \
(grpc_static_mdelem_manifested[77])
(grpc_static_mdelem_manifested()[77])
/* "grpc-accept-encoding": "gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_GZIP \
(grpc_static_mdelem_manifested[78])
(grpc_static_mdelem_manifested()[78])
/* "grpc-accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(grpc_static_mdelem_manifested[79])
(grpc_static_mdelem_manifested()[79])
/* "grpc-accept-encoding": "deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_DEFLATE_COMMA_GZIP \
(grpc_static_mdelem_manifested[80])
(grpc_static_mdelem_manifested()[80])
/* "grpc-accept-encoding": "identity,deflate,gzip" */
#define GRPC_MDELEM_GRPC_ACCEPT_ENCODING_IDENTITY_COMMA_DEFLATE_COMMA_GZIP \
(grpc_static_mdelem_manifested[81])
(grpc_static_mdelem_manifested()[81])
/* "accept-encoding": "identity" */
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY (grpc_static_mdelem_manifested[82])
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY \
(grpc_static_mdelem_manifested()[82])
/* "accept-encoding": "gzip" */
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested[83])
#define GRPC_MDELEM_ACCEPT_ENCODING_GZIP (grpc_static_mdelem_manifested()[83])
/* "accept-encoding": "identity,gzip" */
#define GRPC_MDELEM_ACCEPT_ENCODING_IDENTITY_COMMA_GZIP \
(grpc_static_mdelem_manifested[84])
(grpc_static_mdelem_manifested()[84])
grpc_mdelem grpc_static_mdelem_for_static_strings(intptr_t a, intptr_t b);
typedef enum {
@ -539,15 +581,15 @@ typedef union {
: GRPC_BATCH_CALLOUTS_COUNT)
extern const uint8_t grpc_static_accept_encoding_metadata[8];
#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) \
(GRPC_MAKE_MDELEM( \
&grpc_static_mdelem_table[grpc_static_accept_encoding_metadata[(algs)]] \
.data(), \
GRPC_MDELEM_STORAGE_STATIC))
#define GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(algs) \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table() \
[grpc_static_accept_encoding_metadata[(algs)]] \
.data(), \
GRPC_MDELEM_STORAGE_STATIC))
extern const uint8_t grpc_static_accept_stream_encoding_metadata[4];
#define GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(algs) \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table \
(GRPC_MAKE_MDELEM(&grpc_static_mdelem_table() \
[grpc_static_accept_stream_encoding_metadata[(algs)]] \
.data(), \
GRPC_MDELEM_STORAGE_STATIC))

@ -407,7 +407,7 @@ int MetadataCredentialsPluginWrapper::GetMetadata(
*num_creds_md = 0;
*status = GRPC_STATUS_OK;
*error_details = nullptr;
return true;
return 1;
}
if (w->plugin_->IsBlocking()) {
// The internals of context may be destroyed if GetMetadata is cancelled.

@ -22,6 +22,7 @@
#include <grpcpp/server_context.h>
#include "opencensus/tags/tag_key.h"
#include "opencensus/trace/span.h"
#include "src/cpp/ext/filters/census/channel_filter.h"
#include "src/cpp/ext/filters/census/client_filter.h"
@ -33,27 +34,27 @@ namespace grpc {
// These measure definitions should be kept in sync across opencensus
// implementations--see
// https://github.com/census-instrumentation/opencensus-java/blob/master/contrib/grpc_metrics/src/main/java/io/opencensus/contrib/grpc/metrics/RpcMeasureConstants.java.
::opencensus::stats::TagKey ClientMethodTagKey() {
::opencensus::tags::TagKey ClientMethodTagKey() {
static const auto method_tag_key =
::opencensus::stats::TagKey::Register("grpc_client_method");
::opencensus::tags::TagKey::Register("grpc_client_method");
return method_tag_key;
}
::opencensus::stats::TagKey ClientStatusTagKey() {
::opencensus::tags::TagKey ClientStatusTagKey() {
static const auto status_tag_key =
::opencensus::stats::TagKey::Register("grpc_client_status");
::opencensus::tags::TagKey::Register("grpc_client_status");
return status_tag_key;
}
::opencensus::stats::TagKey ServerMethodTagKey() {
::opencensus::tags::TagKey ServerMethodTagKey() {
static const auto method_tag_key =
::opencensus::stats::TagKey::Register("grpc_server_method");
::opencensus::tags::TagKey::Register("grpc_server_method");
return method_tag_key;
}
::opencensus::stats::TagKey ServerStatusTagKey() {
::opencensus::tags::TagKey ServerStatusTagKey() {
static const auto status_tag_key =
::opencensus::stats::TagKey::Register("grpc_server_status");
::opencensus::tags::TagKey::Register("grpc_server_status");
return status_tag_key;
}

@ -24,6 +24,7 @@
#include "absl/strings/string_view.h"
#include "include/grpcpp/opencensus.h"
#include "opencensus/stats/stats.h"
#include "opencensus/tags/tag_key.h"
namespace grpc_impl {
class ServerContext;
@ -32,10 +33,10 @@ class ServerContext;
namespace grpc {
// The tag keys set when recording RPC stats.
::opencensus::stats::TagKey ClientMethodTagKey();
::opencensus::stats::TagKey ClientStatusTagKey();
::opencensus::stats::TagKey ServerMethodTagKey();
::opencensus::stats::TagKey ServerStatusTagKey();
::opencensus::tags::TagKey ClientMethodTagKey();
::opencensus::tags::TagKey ClientStatusTagKey();
::opencensus::tags::TagKey ServerMethodTagKey();
::opencensus::tags::TagKey ServerStatusTagKey();
// Names of measures used by the plugin--users can create views on these
// measures but should not record data for them.

@ -29,6 +29,7 @@
#include "src/cpp/server/load_reporter/load_reporter.h"
#include "opencensus/stats/internal/set_aggregation_window.h"
#include "opencensus/tags/tag_key.h"
namespace grpc {
namespace load_reporter {
@ -38,12 +39,12 @@ CpuStatsProvider::CpuStatsSample CpuStatsProviderDefaultImpl::GetCpuStats() {
}
CensusViewProvider::CensusViewProvider()
: tag_key_token_(::opencensus::stats::TagKey::Register(kTagKeyToken)),
tag_key_host_(::opencensus::stats::TagKey::Register(kTagKeyHost)),
tag_key_user_id_(::opencensus::stats::TagKey::Register(kTagKeyUserId)),
tag_key_status_(::opencensus::stats::TagKey::Register(kTagKeyStatus)),
: tag_key_token_(::opencensus::tags::TagKey::Register(kTagKeyToken)),
tag_key_host_(::opencensus::tags::TagKey::Register(kTagKeyHost)),
tag_key_user_id_(::opencensus::tags::TagKey::Register(kTagKeyUserId)),
tag_key_status_(::opencensus::tags::TagKey::Register(kTagKeyStatus)),
tag_key_metric_name_(
::opencensus::stats::TagKey::Register(kTagKeyMetricName)) {
::opencensus::tags::TagKey::Register(kTagKeyMetricName)) {
// One view related to starting a call.
auto vd_start_count =
::opencensus::stats::ViewDescriptor()

@ -34,6 +34,7 @@
#include "src/proto/grpc/lb/v1/load_reporter.grpc.pb.h"
#include "opencensus/stats/stats.h"
#include "opencensus/tags/tag_key.h"
namespace grpc {
namespace load_reporter {
@ -75,11 +76,11 @@ class CensusViewProvider {
private:
ViewDescriptorMap view_descriptor_map_;
// Tag keys.
::opencensus::stats::TagKey tag_key_token_;
::opencensus::stats::TagKey tag_key_host_;
::opencensus::stats::TagKey tag_key_user_id_;
::opencensus::stats::TagKey tag_key_status_;
::opencensus::stats::TagKey tag_key_metric_name_;
::opencensus::tags::TagKey tag_key_token_;
::opencensus::tags::TagKey tag_key_host_;
::opencensus::tags::TagKey tag_key_user_id_;
::opencensus::tags::TagKey tag_key_status_;
::opencensus::tags::TagKey tag_key_metric_name_;
};
// The default implementation fetches the real stats from Census.

@ -23,7 +23,7 @@ Unity and provide feedback!
How to test gRPC in a Unity project
1. Create a Unity project that targets .NET 4.x (Edit -> Project Settings -> Editor -> Scripting Runtime Version). gRPC uses APIs that are only available in .NET4.5+ so this is a requirement.
1. Create a Unity project that targets .NET 4.x Equivalent (Edit -> Project Settings -> Player -> Configuration -> Scripting Runtime Version). gRPC uses APIs that are only available in .NET4.5+ so this is a requirement.
2. Download the latest development build of `grpc_unity_package.VERSION.zip` from
[daily builds](https://packages.grpc.io/)

@ -63,9 +63,6 @@ grpc_objc_testing_library(
data = [":TestCertificates"],
defines = [
"DEBUG=1",
"PB_FIELD_32BIT=1",
"PB_NO_PACKED_STRUCTS=1",
"PB_ENABLE_MALLOC=1",
"HOST_PORT_LOCALSSL=localhost:5051",
"HOST_PORT_LOCAL=localhost:5050",
"HOST_PORT_REMOTE=grpc-test.sandbox.googleapis.com",

@ -1721,9 +1721,6 @@
"$(inherited)",
"COCOAPODS=1",
"GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=1",
"PB_FIELD_32BIT=1",
"PB_NO_PACKED_STRUCTS=1",
"PB_ENABLE_MALLOC=1",
"GRPC_TEST_OBJC=1",
);
INFOPLIST_FILE = MacTests/Info.plist;

@ -75,7 +75,7 @@ proto_library(
py_proto_library(
name = "empty_py_pb2",
srcs = [":empty_proto_descriptor"],
deps = [":empty_proto_descriptor"],
)
py_grpc_library(
@ -97,7 +97,7 @@ proto_library(
py_proto_library(
name = "py_messages_proto",
srcs = [":messages_proto_descriptor"],
deps = [":messages_proto_descriptor"],
)
py_grpc_library(
@ -206,7 +206,7 @@ proto_library(
py_proto_library(
name = "py_test_proto",
srcs = [":test_proto_descriptor"],
deps = [":test_proto_descriptor"],
)
py_grpc_library(

@ -10,7 +10,7 @@ proto_library(
py_proto_library(
name = "empty2_proto",
srcs = [":empty2_proto_descriptor"],
deps = [":empty2_proto_descriptor"],
)
proto_library(
@ -23,6 +23,6 @@ proto_library(
py_proto_library(
name = "empty2_extensions_proto",
srcs = [":empty2_extensions_proto_descriptor"],
deps = [":empty2_extensions_proto_descriptor"],
)

@ -1747,6 +1747,64 @@ def dynamic_ssl_server_credentials(initial_certificate_configuration,
certificate_configuration_fetcher, require_client_authentication))
@enum.unique
class LocalConnectionType(enum.Enum):
"""Types of local connection for local credential creation.
Attributes:
UDS: Unix domain socket connections
LOCAL_TCP: Local TCP connections.
"""
UDS = _cygrpc.LocalConnectionType.uds
LOCAL_TCP = _cygrpc.LocalConnectionType.local_tcp
def local_channel_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP):
"""Creates a local ChannelCredentials used for local connections.
This is an EXPERIMENTAL API.
Local credentials are used by local TCP endpoints (e.g. localhost:10000)
also UDS connections. It allows them to create secure channel, hence
transmitting call credentials become possible.
It is useful for 1) eliminating insecure_channel usage; 2) enable unit
testing for call credentials without setting up secrets.
Args:
local_connect_type: Local connection type (either
grpc.LocalConnectionType.UDS or grpc.LocalConnectionType.LOCAL_TCP)
Returns:
A ChannelCredentials for use with a local Channel
"""
return ChannelCredentials(
_cygrpc.channel_credentials_local(local_connect_type.value))
def local_server_credentials(local_connect_type=LocalConnectionType.LOCAL_TCP):
"""Creates a local ServerCredentials used for local connections.
This is an EXPERIMENTAL API.
Local credentials are used by local TCP endpoints (e.g. localhost:10000)
also UDS connections. It allows them to create secure channel, hence
transmitting call credentials become possible.
It is useful for 1) eliminating insecure_channel usage; 2) enable unit
testing for call credentials without setting up secrets.
Args:
local_connect_type: Local connection type (either
grpc.LocalConnectionType.UDS or grpc.LocalConnectionType.LOCAL_TCP)
Returns:
A ServerCredentials for use with a local Server
"""
return ServerCredentials(
_cygrpc.server_credentials_local(local_connect_type.value))
def channel_ready_future(channel):
"""Creates a Future that tracks when a Channel is ready.
@ -1916,6 +1974,7 @@ __all__ = (
'ClientCallDetails',
'ServerCertificateConfiguration',
'ServerCredentials',
'LocalConnectionType',
'UnaryUnaryMultiCallable',
'UnaryStreamMultiCallable',
'StreamUnaryMultiCallable',
@ -1942,6 +2001,8 @@ __all__ = (
'access_token_call_credentials',
'composite_call_credentials',
'composite_channel_credentials',
'local_channel_credentials',
'local_server_credentials',
'ssl_server_credentials',
'ssl_server_certificate_configuration',
'dynamic_ssl_server_credentials',

@ -97,3 +97,8 @@ cdef class ServerCredentials:
cdef object cert_config_fetcher
# whether C-core has asked for the initial_cert_config
cdef bint initial_cert_config_fetched
cdef class LocalChannelCredentials(ChannelCredentials):
cdef grpc_local_connect_type _local_connect_type

@ -328,3 +328,25 @@ cdef grpc_ssl_certificate_config_reload_status _server_cert_config_fetcher_wrapp
cert_config.c_ssl_pem_key_cert_pairs_count)
return GRPC_SSL_CERTIFICATE_CONFIG_RELOAD_NEW
class LocalConnectionType:
uds = UDS
local_tcp = LOCAL_TCP
cdef class LocalChannelCredentials(ChannelCredentials):
def __cinit__(self, grpc_local_connect_type local_connect_type):
self._local_connect_type = local_connect_type
cdef grpc_channel_credentials *c(self) except *:
cdef grpc_local_connect_type local_connect_type
local_connect_type = self._local_connect_type
return grpc_local_credentials_create(local_connect_type)
def channel_credentials_local(grpc_local_connect_type local_connect_type):
return LocalChannelCredentials(local_connect_type)
def server_credentials_local(grpc_local_connect_type local_connect_type):
cdef ServerCredentials credentials = ServerCredentials()
credentials.c_credentials = grpc_local_server_credentials_create(local_connect_type)
return credentials

@ -584,6 +584,12 @@ cdef extern from "grpc/grpc_security.h":
void grpc_auth_context_release(grpc_auth_context *context)
grpc_channel_credentials *grpc_local_credentials_create(
grpc_local_connect_type type)
grpc_server_credentials *grpc_local_server_credentials_create(
grpc_local_connect_type type)
cdef extern from "grpc/compression.h":
ctypedef enum grpc_compression_algorithm:
@ -624,3 +630,9 @@ cdef extern from "grpc/impl/codegen/compression_types.h":
const char *_GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY \
"GRPC_COMPRESSION_REQUEST_ALGORITHM_MD_KEY"
cdef extern from "grpc/grpc_security_constants.h":
ctypedef enum grpc_local_connect_type:
UDS
LOCAL_TCP

@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"])
py_proto_library(
name = "channelz_py_pb2",
srcs = ["//src/proto/grpc/channelz:channelz_proto_descriptors"],
deps = ["//src/proto/grpc/channelz:channelz_proto_descriptors"],
)
py_grpc_library(

@ -3,7 +3,7 @@ package(default_visibility = ["//visibility:public"])
py_proto_library(
name = "health_py_pb2",
srcs = ["//src/proto/grpc/health/v1:health_proto_descriptor",],
deps = ["//src/proto/grpc/health/v1:health_proto_descriptor",],
)
py_grpc_library(

@ -5,7 +5,7 @@ package(default_visibility = ["//visibility:public"])
py_proto_library(
name = "reflection_py_pb2",
srcs = ["//src/proto/grpc/reflection/v1alpha:reflection_proto_descriptor",],
deps = ["//src/proto/grpc/reflection/v1alpha:reflection_proto_descriptor",],
)
py_grpc_library(

@ -74,7 +74,8 @@ class ServicerContext(grpc.ServicerContext):
_common.fuss_with_metadata(trailing_metadata))
def abort(self, code, details):
raise NotImplementedError()
with self._rpc._condition:
self._rpc._abort(code, details)
def abort_with_status(self, status):
raise NotImplementedError()

@ -154,7 +154,9 @@ class TestGevent(setuptools.Command):
'channelz._channelz_servicer_test.ChannelzServicerTest.test_many_subchannels_and_sockets',
'channelz._channelz_servicer_test.ChannelzServicerTest.test_streaming_rpc',
# TODO(https://github.com/grpc/grpc/issues/15411) enable this test
'unit._cython._channel_test.ChannelTest.test_negative_deadline_connectivity'
'unit._cython._channel_test.ChannelTest.test_negative_deadline_connectivity',
# TODO(https://github.com/grpc/grpc/issues/15411) enable this test
'unit._local_credentials_test.LocalCredentialsTest',
)
BANNED_WINDOWS_TESTS = (
# TODO(https://github.com/grpc/grpc/pull/15411) enable this test

@ -53,6 +53,7 @@
"unit._interceptor_test.InterceptorTest",
"unit._invalid_metadata_test.InvalidMetadataTest",
"unit._invocation_defects_test.InvocationDefectsTest",
"unit._local_credentials_test.LocalCredentialsTest",
"unit._logging_test.LoggingTest",
"unit._metadata_code_details_test.MetadataCodeDetailsTest",
"unit._metadata_flags_test.MetadataFlagsTest",

@ -19,6 +19,7 @@ GRPCIO_TESTS_UNIT = [
"_interceptor_test.py",
"_invalid_metadata_test.py",
"_invocation_defects_test.py",
"_local_credentials_test.py",
"_logging_test.py",
"_metadata_code_details_test.py",
"_metadata_test.py",

@ -60,6 +60,9 @@ class AllTest(unittest.TestCase):
'ServiceRpcHandler',
'Server',
'ServerInterceptor',
'LocalConnectionType',
'local_channel_credentials',
'local_server_credentials',
'unary_unary_rpc_method_handler',
'unary_stream_rpc_method_handler',
'stream_unary_rpc_method_handler',

@ -0,0 +1,75 @@
# Copyright 2019 The 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.
"""Test of RPCs made using local credentials."""
import unittest
import os
from concurrent.futures import ThreadPoolExecutor
import grpc
class _GenericHandler(grpc.GenericRpcHandler):
def service(self, handler_call_details):
return grpc.unary_unary_rpc_method_handler(
lambda request, unused_context: request)
class LocalCredentialsTest(unittest.TestCase):
def _create_server(self):
server = grpc.server(ThreadPoolExecutor())
server.add_generic_rpc_handlers((_GenericHandler(),))
return server
@unittest.skipIf(os.name == 'nt',
'TODO(https://github.com/grpc/grpc/issues/20078)')
def test_local_tcp(self):
server_addr = 'localhost:{}'
channel_creds = grpc.local_channel_credentials(
grpc.LocalConnectionType.LOCAL_TCP)
server_creds = grpc.local_server_credentials(
grpc.LocalConnectionType.LOCAL_TCP)
server = self._create_server()
port = server.add_secure_port(server_addr.format(0), server_creds)
server.start()
with grpc.secure_channel(server_addr.format(port),
channel_creds) as channel:
self.assertEqual(b'abc',
channel.unary_unary('/test/method')(
b'abc', wait_for_ready=True))
server.stop(None)
@unittest.skipIf(os.name == 'nt',
'Unix Domain Socket is not supported on Windows')
def test_uds(self):
server_addr = 'unix:/tmp/grpc_fullstack_test'
channel_creds = grpc.local_channel_credentials(
grpc.LocalConnectionType.UDS)
server_creds = grpc.local_server_credentials(
grpc.LocalConnectionType.UDS)
server = self._create_server()
server.add_secure_port(server_addr, server_creds)
server.start()
with grpc.secure_channel(server_addr, channel_creds) as channel:
self.assertEqual(b'abc',
channel.unary_unary('/test/method')(
b'abc', wait_for_ready=True))
server.stop(None)
if __name__ == '__main__':
unittest.main()

@ -145,8 +145,6 @@
## Some libraries are shared even with BUILD_SHARED_LIBRARIES=OFF
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
add_definitions(-DPB_FIELD_32BIT)
if (MSVC)
include(cmake/msvc_static_runtime.cmake)
add_definitions(-D_WIN32_WINNT=0x600 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -D_WINSOCK_DEPRECATED_NO_WARNINGS)

@ -321,7 +321,7 @@
endif
GTEST_LIB = -Ithird_party/googletest/googletest/include -Ithird_party/googletest/googletest third_party/googletest/googletest/src/gtest-all.cc -Ithird_party/googletest/googlemock/include -Ithird_party/googletest/googlemock third_party/googletest/googlemock/src/gmock-all.cc
GTEST_LIB += -lgflags
GTEST_LIB += -lgflags -std=c++11
ifeq ($(V),1)
E = @:
Q =

@ -16,8 +16,8 @@
LIBS="-lpthread $LIBS"
CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2 -D PB_FIELD_32BIT=1"
CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2 -D PB_FIELD_32BIT=1"
CFLAGS="-Wall -Werror -Wno-parentheses-equality -Wno-unused-value -std=c11 -g -O2"
CXXFLAGS="-std=c++11 -fno-exceptions -fno-rtti -g -O2"
GRPC_SHARED_LIBADD="-lpthread $GRPC_SHARED_LIBADD"
PHP_REQUIRE_CXX()
PHP_ADD_LIBRARY(pthread)

@ -23,7 +23,6 @@
EXTENSION("grpc", grpc_source, null,
"/DOPENSSL_NO_ASM /D_GNU_SOURCE /DWIN32_LEAN_AND_MEAN "+
"/D_HAS_EXCEPTIONS=0 /DNOMINMAX /DGRPC_ARES=0 /D_WIN32_WINNT=0x600 "+
"/DPB_FIELD_32BIT "+
"/I"+configure_module_dirname+" "+
"/I"+configure_module_dirname+"\\include "+
"/I"+configure_module_dirname+"\\src\\core\\ext\\upb-generated "+

@ -170,7 +170,7 @@
s.pod_target_xcconfig = {
'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(PODS_TARGET_SRCROOT)/include"',
'USER_HEADER_SEARCH_PATHS' => '"$(PODS_TARGET_SRCROOT)"',
'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"',
'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"',
'CLANG_WARN_STRICT_PROTOTYPES' => 'NO',
'CLANG_WARN_DOCUMENTATION_COMMENTS' => 'NO',

@ -144,12 +144,12 @@
# build.
'USE_HEADERMAP' => 'NO',
'ALWAYS_SEARCH_USER_PATHS' => 'NO',
'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1" "PB_NO_PACKED_STRUCTS=1"',
'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "COCOAPODS=1"',
'CLANG_WARN_STRICT_PROTOTYPES' => 'NO',
}
s.default_subspecs = 'Interface', 'Implementation'
s.compiler_flags = '-DGRPC_ARES=0', '-DPB_FIELD_32BIT'
s.compiler_flags = '-DGRPC_ARES=0'
s.libraries = 'c++'
# Like many other C libraries, gRPC-Core has its public headers under `include/<libname>/` and its

@ -1,3 +0,0 @@
# Add Debian 'testing' repository
RUN echo 'deb http://ftp.de.debian.org/debian testing main' >> /etc/apt/sources.list
RUN echo 'APT::Default-Release "stable";' | tee -a /etc/apt/apt.conf.d/00local

@ -16,5 +16,5 @@
<%include file="../../python_stretch.include"/>
RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev
RUN apt-get update && apt-get -t stable install -y python3.7 python3-all-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7

@ -3,7 +3,9 @@ FROM debian:stretch
<%include file="./apt_get_basic.include"/>
<%include file="./gcp_api_libraries.include"/>
<%include file="./apt_get_python_27.include"/>
<%include file="./debian_testing_repo.include"/>
# Add Debian 'buster' repository, we will need it for installing newer versions of python
RUN echo 'deb http://ftp.de.debian.org/debian buster main' >> /etc/apt/sources.list
RUN echo 'APT::Default-Release "stretch";' | tee -a /etc/apt/apt.conf.d/00local
<%include file="./run_tests_addons.include"/>
# Define the default command.
CMD ["bash"]

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM 32bit/debian:jessie
FROM i386/debian:jessie
RUN sed -i '/deb http:\/\/http.debian.net\/debian jessie-updates main/d' /etc/apt/sources.list
<%include file="../../apt_get_basic.include"/>

@ -16,5 +16,17 @@
<%include file="../../python_stretch.include"/>
RUN apt-get update && apt-get -t testing install -y python3.6 python3-all-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
RUN apt-get install -y jq zlib1g-dev libssl-dev
RUN apt-get install -y jq build-essential libffi-dev
RUN cd /tmp && ${'\\'}
wget -q https://github.com/python/cpython/archive/v3.6.9.tar.gz && ${'\\'}
tar xzvf v3.6.9.tar.gz && ${'\\'}
cd cpython-3.6.9 && ${'\\'}
./configure && ${'\\'}
make install
RUN python3.6 -m ensurepip && ${'\\'}
python3.6 -m pip install coverage

@ -16,7 +16,7 @@
<%include file="../../python_stretch.include"/>
RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev
RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7
# for Python test coverage reporting

@ -18,11 +18,14 @@
<%include file="../../python_stretch.include"/>
RUN apt-get install -y jq zlib1g-dev libssl-dev
COPY get_cpython.sh /tmp
RUN apt-get install -y jq build-essential libffi-dev && ${'\\'}
chmod +x /tmp/get_cpython.sh && ${'\\'}
/tmp/get_cpython.sh && ${'\\'}
rm /tmp/get_cpython.sh
RUN apt-get install -y jq build-essential libffi-dev
RUN cd /tmp && ${'\\'}
wget -q https://github.com/python/cpython/archive/v3.8.0b3.tar.gz && ${'\\'}
tar xzvf v3.8.0b3.tar.gz && ${'\\'}
cd cpython-3.8.0b3 && ${'\\'}
./configure && ${'\\'}
make install
RUN python3.8 -m ensurepip && ${'\\'}
python3.8 -m pip install coverage

@ -18,7 +18,7 @@
<%include file="../../cxx_deps.include"/>
#========================
# Sanity test dependencies
RUN apt-get update && apt-get -t testing install -y python3.7 python3-all-dev
RUN apt-get update && apt-get -t buster install -y python3.7 python3-all-dev
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.7
# Make Python 3.7 the default Python 3 version
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 1

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save