Merge branch 'master' into server-context

pull/23916/head
Karthik Ravi Shankar 5 years ago
commit dc3e1097e9
  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/ISSUE_TEMPLATE/question.md
  5. 2
      .github/pull_request_template.md
  6. 2
      .gitmodules
  7. 33
      BUILD
  8. 12
      BUILD.gn
  9. 83
      CMakeLists.txt
  10. 15763
      Makefile
  11. 8
      bazel/grpc_deps.bzl
  12. 54
      build_autogenerated.yaml
  13. 16
      config.m4
  14. 18
      config.w32
  15. 7
      doc/python/sphinx/grpc.rst
  16. 7
      doc/ssl-performance.md
  17. 5
      doc/status_ordering.md
  18. 2
      examples/csharp/Helloworld/GreeterClient/Program.cs
  19. 2
      examples/csharp/Helloworld/GreeterServer/Program.cs
  20. 2
      examples/csharp/HelloworldLegacyCsproj/GreeterClient/Program.cs
  21. 2
      examples/csharp/HelloworldLegacyCsproj/GreeterServer/Program.cs
  22. 4
      examples/csharp/HelloworldUnity/Assets/Scripts/HelloWorldTest.cs
  23. 6
      examples/csharp/HelloworldXamarin/Droid/MainActivity.cs
  24. 6
      examples/csharp/HelloworldXamarin/iOS/ViewController.cs
  25. 2
      examples/csharp/RouteGuide/RouteGuideClient/Program.cs
  26. 2
      examples/csharp/RouteGuide/RouteGuideServer/Program.cs
  27. 2
      examples/csharp/Xds/GreeterClient/Program.cs
  28. 2
      examples/csharp/Xds/GreeterServer/Program.cs
  29. 8
      examples/csharp/Xds/README.md
  30. 40
      examples/python/no_codegen/greeter_client.py
  31. 40
      examples/python/no_codegen/greeter_server.py
  32. 38
      examples/python/no_codegen/helloworld.proto
  33. 14
      gRPC-C++.podspec
  34. 22
      gRPC-Core.podspec
  35. 37
      grpc.gemspec
  36. 12
      grpc.gyp
  37. 22
      include/grpc/impl/codegen/README.md
  38. 7
      include/grpcpp/channel.h
  39. 21
      include/grpcpp/impl/codegen/README.md
  40. 27
      include/grpcpp/impl/codegen/async_stream_impl.h
  41. 12
      include/grpcpp/impl/codegen/async_unary_call_impl.h
  42. 8
      include/grpcpp/impl/codegen/call_op_set.h
  43. 9
      include/grpcpp/impl/codegen/channel_interface.h
  44. 36
      include/grpcpp/impl/codegen/client_callback_impl.h
  45. 505
      include/grpcpp/impl/codegen/client_context.h
  46. 517
      include/grpcpp/impl/codegen/client_context_impl.h
  47. 17
      include/grpcpp/impl/codegen/client_interceptor.h
  48. 9
      include/grpcpp/impl/codegen/client_unary_call.h
  49. 2
      include/grpcpp/impl/codegen/intercepted_channel.h
  50. 21
      include/grpcpp/impl/codegen/sync_stream_impl.h
  51. 4
      include/grpcpp/security/alts_context.h
  52. 37
      package.xml
  53. 14
      src/boringssl/boringssl_prefix_symbols.h
  54. 2
      src/compiler/BUILD
  55. 2
      src/compiler/ruby_generator_string-inl.h
  56. 5
      src/core/ext/filters/client_channel/backup_poller.cc
  57. 49
      src/core/ext/filters/client_channel/client_channel.cc
  58. 3
      src/core/ext/filters/client_channel/health/health_check_client.cc
  59. 2
      src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc
  60. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc
  61. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc
  62. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_windows.cc
  63. 2
      src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc
  64. 2
      src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc
  65. 21
      src/core/ext/filters/client_channel/subchannel.cc
  66. 7
      src/core/ext/filters/client_channel/subchannel.h
  67. 2
      src/core/ext/filters/load_reporting/server_load_reporting_filter.cc
  68. 9
      src/core/ext/transport/chttp2/client/chttp2_connector.cc
  69. 148
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  70. 29
      src/core/ext/transport/chttp2/transport/parsing.cc
  71. 15
      src/core/ext/transport/inproc/inproc_transport.cc
  72. 43
      src/core/ext/upb-generated/third_party/istio/security/proto/providers/google/meshca.upb.c
  73. 103
      src/core/ext/upb-generated/third_party/istio/security/proto/providers/google/meshca.upb.h
  74. 7
      src/core/ext/xds/xds_client.cc
  75. 2
      src/core/lib/iomgr/parse_address.cc
  76. 6
      src/core/lib/iomgr/parse_address.h
  77. 100
      src/core/lib/security/authorization/authorization_engine.cc
  78. 14
      src/core/lib/security/authorization/authorization_engine.h
  79. 153
      src/core/lib/security/authorization/evaluate_args.cc
  80. 59
      src/core/lib/security/authorization/evaluate_args.h
  81. 12
      src/core/lib/security/authorization/mock_cel/activation.h
  82. 28
      src/core/lib/security/authorization/mock_cel/cel_value.h
  83. 48
      src/core/lib/surface/channel.cc
  84. 14
      src/core/lib/surface/channel.h
  85. 7
      src/core/lib/transport/transport.h
  86. 44
      src/core/lib/uri/uri_parser.cc
  87. 4
      src/core/lib/uri/uri_parser.h
  88. 22
      src/core/tsi/alts/handshaker/alts_tsi_handshaker.cc
  89. 12
      src/core/tsi/ssl_transport_security.cc
  90. 16
      src/cpp/client/client_context.cc
  91. 19
      src/cpp/common/alts_context.cc
  92. 2
      src/cpp/ext/filters/census/grpc_plugin.cc
  93. 5
      src/cpp/server/server_cc.cc
  94. 2
      src/cpp/server/server_context.cc
  95. 90
      src/csharp/Grpc.Core.Tests/ServerBindFailedTest.cs
  96. 16
      src/csharp/Grpc.Core/Server.cs
  97. 174
      src/csharp/Grpc.IntegrationTesting/Messages.cs
  98. 5
      src/csharp/Grpc.IntegrationTesting/Test.cs
  99. 127
      src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
  100. 171
      src/csharp/Grpc.IntegrationTesting/XdsInteropClient.cs
  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: nicolasnoble
assignees: veblush
---

@ -2,7 +2,7 @@
name: Request a cleanup
about: Suggest a cleanup in our repository
labels: kind/internal cleanup, priority/P2
assignees: nicolasnoble
assignees: veblush
---

@ -2,7 +2,7 @@
name: Request a feature
about: Suggest an idea for this project
labels: kind/enhancement, priority/P2
assignees: nicolasnoble
assignees: veblush
---

@ -2,7 +2,7 @@
name: Ask a question
about: Ask a question
labels: kind/question, priority/P3
assignees: nicolasnoble
assignees: veblush
---

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

2
.gitmodules vendored

@ -22,7 +22,7 @@
url = https://github.com/google/boringssl.git
[submodule "third_party/re2"]
path = third_party/re2
url = git://github.com/google/re2.git
url = https://github.com/google/re2.git
[submodule "third_party/cares/cares"]
path = third_party/cares/cares
url = https://github.com/c-ares/c-ares.git

33
BUILD

@ -325,6 +325,7 @@ grpc_cc_library(
public_hdrs = GRPC_PUBLIC_HDRS + GRPC_SECURE_PUBLIC_HDRS,
standalone = True,
deps = [
"grpc_authorization_engine",
"grpc_common",
"grpc_lb_policy_cds_secure",
"grpc_lb_policy_eds_secure",
@ -715,6 +716,7 @@ grpc_cc_library(
"src/core/lib/iomgr/is_epollexclusive_available.cc",
"src/core/lib/iomgr/load_file.cc",
"src/core/lib/iomgr/lockfree_event.cc",
"src/core/lib/iomgr/parse_address.cc",
"src/core/lib/iomgr/polling_entity.cc",
"src/core/lib/iomgr/pollset.cc",
"src/core/lib/iomgr/pollset_custom.cc",
@ -870,6 +872,7 @@ grpc_cc_library(
"src/core/lib/iomgr/load_file.h",
"src/core/lib/iomgr/lockfree_event.h",
"src/core/lib/iomgr/nameser.h",
"src/core/lib/iomgr/parse_address.h",
"src/core/lib/iomgr/polling_entity.h",
"src/core/lib/iomgr/pollset.h",
"src/core/lib/iomgr/pollset_custom.h",
@ -952,6 +955,7 @@ grpc_cc_library(
"madler_zlib",
"absl/container:inlined_vector",
"absl/status",
"absl/strings",
"absl/types:optional",
],
language = "c++",
@ -1026,7 +1030,6 @@ grpc_cc_library(
"src/core/ext/filters/client_channel/lb_policy/child_policy_handler.cc",
"src/core/ext/filters/client_channel/lb_policy_registry.cc",
"src/core/ext/filters/client_channel/local_subchannel_pool.cc",
"src/core/ext/filters/client_channel/parse_address.cc",
"src/core/ext/filters/client_channel/proxy_mapper_registry.cc",
"src/core/ext/filters/client_channel/resolver.cc",
"src/core/ext/filters/client_channel/resolver_registry.cc",
@ -1057,7 +1060,6 @@ grpc_cc_library(
"src/core/ext/filters/client_channel/lb_policy_factory.h",
"src/core/ext/filters/client_channel/lb_policy_registry.h",
"src/core/ext/filters/client_channel/local_subchannel_pool.h",
"src/core/ext/filters/client_channel/parse_address.h",
"src/core/ext/filters/client_channel/proxy_mapper.h",
"src/core/ext/filters/client_channel/proxy_mapper_registry.h",
"src/core/ext/filters/client_channel/resolver.h",
@ -1855,17 +1857,23 @@ grpc_cc_library(
name = "grpc_authorization_engine",
srcs = [
"src/core/lib/security/authorization/authorization_engine.cc",
"src/core/lib/security/authorization/evaluate_args.cc",
],
hdrs = [
"src/core/lib/security/authorization/authorization_engine.h",
"src/core/lib/security/authorization/evaluate_args.h",
"src/core/lib/security/authorization/mock_cel/activation.h",
"src/core/lib/security/authorization/mock_cel/cel_value.h",
],
external_deps = [
"absl/container:flat_hash_set",
],
language = "c++",
deps = [
"envoy_ads_upb",
"google_api_upb",
"grpc_base",
"grpc_secure",
],
)
@ -2254,7 +2262,6 @@ grpc_cc_library(
"include/grpcpp/impl/codegen/client_callback.h",
"include/grpcpp/impl/codegen/client_callback_impl.h",
"include/grpcpp/impl/codegen/client_context.h",
"include/grpcpp/impl/codegen/client_context_impl.h",
"include/grpcpp/impl/codegen/client_interceptor.h",
"include/grpcpp/impl/codegen/client_unary_call.h",
"include/grpcpp/impl/codegen/completion_queue.h",
@ -2829,6 +2836,26 @@ grpc_cc_library(
],
)
# Once upb code-gen issue is resolved, replace meshca_upb with this.
# meshca_upb_proto_library(
# name = "meshca_upb",
# deps = ["//third_party/istio/security/proto/providers/google:meshca_proto"],
# )
grpc_cc_library(
name = "meshca_upb",
srcs = [
"src/core/ext/upb-generated/third_party/istio/security/proto/providers/google/meshca.upb.c",
],
hdrs = [
"src/core/ext/upb-generated/third_party/istio/security/proto/providers/google/meshca.upb.h",
],
language = "c++",
deps = [
"google_api_upb",
],
)
# Once upb code-gen issue is resolved, replace alts_upb with this.
# grpc_upb_proto_library(
# name = "alts_upb",

@ -257,8 +257,6 @@ config("grpc_config") {
"src/core/ext/filters/client_channel/lb_policy_registry.h",
"src/core/ext/filters/client_channel/local_subchannel_pool.cc",
"src/core/ext/filters/client_channel/local_subchannel_pool.h",
"src/core/ext/filters/client_channel/parse_address.cc",
"src/core/ext/filters/client_channel/parse_address.h",
"src/core/ext/filters/client_channel/proxy_mapper.h",
"src/core/ext/filters/client_channel/proxy_mapper_registry.cc",
"src/core/ext/filters/client_channel/proxy_mapper_registry.h",
@ -688,6 +686,8 @@ config("grpc_config") {
"src/core/lib/iomgr/lockfree_event.cc",
"src/core/lib/iomgr/lockfree_event.h",
"src/core/lib/iomgr/nameser.h",
"src/core/lib/iomgr/parse_address.cc",
"src/core/lib/iomgr/parse_address.h",
"src/core/lib/iomgr/poller/eventmanager_libuv.cc",
"src/core/lib/iomgr/poller/eventmanager_libuv.h",
"src/core/lib/iomgr/polling_entity.cc",
@ -788,6 +788,12 @@ config("grpc_config") {
"src/core/lib/json/json.h",
"src/core/lib/json/json_reader.cc",
"src/core/lib/json/json_writer.cc",
"src/core/lib/security/authorization/authorization_engine.cc",
"src/core/lib/security/authorization/authorization_engine.h",
"src/core/lib/security/authorization/evaluate_args.cc",
"src/core/lib/security/authorization/evaluate_args.h",
"src/core/lib/security/authorization/mock_cel/activation.h",
"src/core/lib/security/authorization/mock_cel/cel_value.h",
"src/core/lib/security/context/security_context.cc",
"src/core/lib/security/context/security_context.h",
"src/core/lib/security/credentials/alts/alts_credentials.cc",
@ -1003,6 +1009,7 @@ config("grpc_config") {
":absl/strings:strings",
":absl/status:status",
":absl/container:inlined_vector",
":absl/container:flat_hash_set",
"//third_party/cares",
":address_sorting",
]
@ -1127,7 +1134,6 @@ config("grpc_config") {
"include/grpcpp/impl/codegen/client_callback.h",
"include/grpcpp/impl/codegen/client_callback_impl.h",
"include/grpcpp/impl/codegen/client_context.h",
"include/grpcpp/impl/codegen/client_context_impl.h",
"include/grpcpp/impl/codegen/client_interceptor.h",
"include/grpcpp/impl/codegen/client_unary_call.h",
"include/grpcpp/impl/codegen/completion_queue.h",

@ -103,14 +103,19 @@ set_property(CACHE gRPC_ABSL_PROVIDER PROPERTY STRINGS "module" "package")
set(gRPC_ABSL_USED_TARGETS
absl_algorithm
absl_algorithm_container
absl_atomic_hook
absl_bad_optional_access
absl_bad_variant_access
absl_base
absl_base_internal
absl_bits
absl_city
absl_civil_time
absl_compressed_tuple
absl_config
absl_container_common
absl_container_memory
absl_cord
absl_core_headers
absl_debugging_internal
@ -118,17 +123,27 @@ set(gRPC_ABSL_USED_TARGETS
absl_dynamic_annotations
absl_endian
absl_errno_saver
absl_exponential_biased
absl_fixed_array
absl_flat_hash_set
absl_function_ref
absl_graphcycles_internal
absl_hash
absl_hash_function_defaults
absl_hash_policy_traits
absl_hashtable_debug_hooks
absl_hashtablez_sampler
absl_have_sse
absl_inlined_vector
absl_inlined_vector_internal
absl_int128
absl_kernel_timeout_internal
absl_layout
absl_log_severity
absl_malloc_internal
absl_memory
absl_optional
absl_raw_hash_set
absl_raw_logging_internal
absl_span
absl_spinlock_wait
@ -145,6 +160,7 @@ set(gRPC_ABSL_USED_TARGETS
absl_time_zone
absl_type_traits
absl_utility
absl_variant
absl_meta
)
@ -795,6 +811,7 @@ if(gRPC_BUILD_TESTS)
add_dependencies(buildtests_cxx duplicate_header_bad_client_test)
add_dependencies(buildtests_cxx end2end_test)
add_dependencies(buildtests_cxx error_details_test)
add_dependencies(buildtests_cxx evaluate_args_test)
add_dependencies(buildtests_cxx eventmanager_libuv_test)
add_dependencies(buildtests_cxx exception_test)
add_dependencies(buildtests_cxx filter_end2end_test)
@ -1050,6 +1067,7 @@ add_library(end2end_nosec_tests
test/core/end2end/tests/retry_throttled.cc
test/core/end2end/tests/retry_too_many_attempts.cc
test/core/end2end/tests/server_finishes_request.cc
test/core/end2end/tests/server_streaming.cc
test/core/end2end/tests/shutdown_finishes_calls.cc
test/core/end2end/tests/shutdown_finishes_tags.cc
test/core/end2end/tests/simple_cacheable_request.cc
@ -1183,6 +1201,7 @@ add_library(end2end_tests
test/core/end2end/tests/retry_throttled.cc
test/core/end2end/tests/retry_too_many_attempts.cc
test/core/end2end/tests/server_finishes_request.cc
test/core/end2end/tests/server_streaming.cc
test/core/end2end/tests/shutdown_finishes_calls.cc
test/core/end2end/tests/shutdown_finishes_tags.cc
test/core/end2end/tests/simple_cacheable_request.cc
@ -1421,7 +1440,6 @@ add_library(grpc
src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc
src/core/ext/filters/client_channel/lb_policy_registry.cc
src/core/ext/filters/client_channel/local_subchannel_pool.cc
src/core/ext/filters/client_channel/parse_address.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@ -1646,6 +1664,7 @@ add_library(grpc
src/core/lib/iomgr/is_epollexclusive_available.cc
src/core/lib/iomgr/load_file.cc
src/core/lib/iomgr/lockfree_event.cc
src/core/lib/iomgr/parse_address.cc
src/core/lib/iomgr/poller/eventmanager_libuv.cc
src/core/lib/iomgr/polling_entity.cc
src/core/lib/iomgr/pollset.cc
@ -1702,6 +1721,8 @@ add_library(grpc
src/core/lib/iomgr/work_serializer.cc
src/core/lib/json/json_reader.cc
src/core/lib/json/json_writer.cc
src/core/lib/security/authorization/authorization_engine.cc
src/core/lib/security/authorization/evaluate_args.cc
src/core/lib/security/context/security_context.cc
src/core/lib/security/credentials/alts/alts_credentials.cc
src/core/lib/security/credentials/alts/check_gcp_environment.cc
@ -1858,6 +1879,7 @@ target_link_libraries(grpc
absl::strings
absl::status
absl::inlined_vector
absl::flat_hash_set
)
if(_gRPC_PLATFORM_IOS OR _gRPC_PLATFORM_MAC)
target_link_libraries(grpc "-framework CoreFoundation")
@ -1944,6 +1966,7 @@ if(gRPC_BUILD_TESTS)
add_library(grpc_test_util
test/core/util/cmdline.cc
test/core/util/debugger_macros.cc
test/core/util/eval_args_mock_endpoint.cc
test/core/util/fuzzer_util.cc
test/core/util/grpc_profiler.cc
test/core/util/histogram.cc
@ -2010,6 +2033,7 @@ if(gRPC_BUILD_TESTS)
add_library(grpc_test_util_unsecure
test/core/util/cmdline.cc
test/core/util/debugger_macros.cc
test/core/util/eval_args_mock_endpoint.cc
test/core/util/fuzzer_util.cc
test/core/util/grpc_profiler.cc
test/core/util/histogram.cc
@ -2105,7 +2129,6 @@ add_library(grpc_unsecure
src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc
src/core/ext/filters/client_channel/lb_policy_registry.cc
src/core/ext/filters/client_channel/local_subchannel_pool.cc
src/core/ext/filters/client_channel/parse_address.cc
src/core/ext/filters/client_channel/proxy_mapper_registry.cc
src/core/ext/filters/client_channel/resolver.cc
src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@ -2324,6 +2347,7 @@ add_library(grpc_unsecure
src/core/lib/iomgr/is_epollexclusive_available.cc
src/core/lib/iomgr/load_file.cc
src/core/lib/iomgr/lockfree_event.cc
src/core/lib/iomgr/parse_address.cc
src/core/lib/iomgr/poller/eventmanager_libuv.cc
src/core/lib/iomgr/polling_entity.cc
src/core/lib/iomgr/pollset.cc
@ -2771,7 +2795,6 @@ foreach(_hdr
include/grpcpp/impl/codegen/client_callback.h
include/grpcpp/impl/codegen/client_callback_impl.h
include/grpcpp/impl/codegen/client_context.h
include/grpcpp/impl/codegen/client_context_impl.h
include/grpcpp/impl/codegen/client_interceptor.h
include/grpcpp/impl/codegen/client_unary_call.h
include/grpcpp/impl/codegen/completion_queue.h
@ -3456,7 +3479,6 @@ foreach(_hdr
include/grpcpp/impl/codegen/client_callback.h
include/grpcpp/impl/codegen/client_callback_impl.h
include/grpcpp/impl/codegen/client_context.h
include/grpcpp/impl/codegen/client_context_impl.h
include/grpcpp/impl/codegen/client_interceptor.h
include/grpcpp/impl/codegen/client_unary_call.h
include/grpcpp/impl/codegen/completion_queue.h
@ -6582,7 +6604,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(parse_address_test
test/core/client_channel/parse_address_test.cc
test/core/iomgr/parse_address_test.cc
)
target_include_directories(parse_address_test
@ -6613,7 +6635,7 @@ if(gRPC_BUILD_TESTS)
if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
add_executable(parse_address_with_named_scope_id_test
test/core/client_channel/parse_address_with_named_scope_id_test.cc
test/core/iomgr/parse_address_with_named_scope_id_test.cc
)
target_include_directories(parse_address_with_named_scope_id_test
@ -7990,7 +8012,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(uri_parser_test
test/core/client_channel/uri_parser_test.cc
test/core/uri/uri_parser_test.cc
)
target_include_directories(uri_parser_test
@ -8408,7 +8430,6 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(authorization_engine_test
src/core/lib/security/authorization/authorization_engine.cc
test/core/security/authorization_engine_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
@ -10744,6 +10765,45 @@ target_link_libraries(error_details_test
)
endif()
if(gRPC_BUILD_TESTS)
add_executable(evaluate_args_test
test/core/security/evaluate_args_test.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
)
target_include_directories(evaluate_args_test
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
${_gRPC_ADDRESS_SORTING_INCLUDE_DIR}
${_gRPC_RE2_INCLUDE_DIR}
${_gRPC_SSL_INCLUDE_DIR}
${_gRPC_UPB_GENERATED_DIR}
${_gRPC_UPB_GRPC_GENERATED_DIR}
${_gRPC_UPB_INCLUDE_DIR}
${_gRPC_ZLIB_INCLUDE_DIR}
third_party/googletest/googletest/include
third_party/googletest/googletest
third_party/googletest/googlemock/include
third_party/googletest/googlemock
${_gRPC_PROTO_GENS_DIR}
)
target_link_libraries(evaluate_args_test
${_gRPC_PROTOBUF_LIBRARIES}
${_gRPC_ALLTARGETS_LIBRARIES}
grpc_test_util
grpc
gpr
address_sorting
upb
${_gRPC_GFLAGS_LIBRARIES}
)
endif()
if(gRPC_BUILD_TESTS)
@ -14681,6 +14741,7 @@ if(_gRPC_PLATFORM_LINUX OR _gRPC_PLATFORM_MAC OR _gRPC_PLATFORM_POSIX)
${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/testing/simple_messages.grpc.pb.h
test/core/util/cmdline.cc
test/core/util/debugger_macros.cc
test/core/util/eval_args_mock_endpoint.cc
test/core/util/fuzzer_util.cc
test/core/util/grpc_profiler.cc
test/core/util/histogram.cc
@ -15516,7 +15577,7 @@ endif()
if(gRPC_BUILD_TESTS)
add_executable(uri_fuzzer_test_one_entry
test/core/client_channel/uri_fuzzer_test.cc
test/core/uri/uri_fuzzer_test.cc
test/core/util/one_corpus_entry_fuzzer.cc
third_party/googletest/googletest/src/gtest-all.cc
third_party/googletest/googlemock/src/gmock-all.cc
@ -15622,7 +15683,7 @@ generate_pkgconfig(
"high performance general RPC framework"
"${gRPC_CORE_VERSION}"
"gpr openssl"
"-lgrpc -laddress_sorting -lre2 -lupb -lcares -lz -labsl_status -labsl_cord -labsl_bad_optional_access -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_raw_logging_internal -labsl_log_severity -labsl_dynamic_annotations"
"-lgrpc -laddress_sorting -lre2 -lupb -lcares -lz -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_hash -labsl_bad_variant_access -labsl_city -labsl_status -labsl_cord -labsl_bad_optional_access -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_raw_logging_internal -labsl_log_severity -labsl_dynamic_annotations"
""
"grpc.pc")
@ -15642,7 +15703,7 @@ generate_pkgconfig(
"C++ wrapper for gRPC"
"${gRPC_CPP_VERSION}"
"grpc"
"-lgrpc++ -labsl_status -labsl_cord -labsl_bad_optional_access -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_raw_logging_internal -labsl_log_severity -labsl_dynamic_annotations"
"-lgrpc++ -labsl_raw_hash_set -labsl_hashtablez_sampler -labsl_exponential_biased -labsl_hash -labsl_bad_variant_access -labsl_city -labsl_status -labsl_cord -labsl_bad_optional_access -labsl_str_format_internal -labsl_synchronization -labsl_graphcycles_internal -labsl_symbolize -labsl_demangle_internal -labsl_stacktrace -labsl_debugging_internal -labsl_malloc_internal -labsl_time -labsl_time_zone -labsl_civil_time -labsl_strings -labsl_strings_internal -labsl_throw_delegate -labsl_int128 -labsl_base -labsl_spinlock_wait -labsl_raw_logging_internal -labsl_log_severity -labsl_dynamic_annotations"
""
"grpc++.pc")

15763
Makefile

File diff suppressed because it is too large Load Diff

@ -136,11 +136,11 @@ def grpc_deps():
name = "boringssl",
# Use github mirror instead of https://boringssl.googlesource.com/boringssl
# to obtain a boringssl archive with consistent sha256
sha256 = "5bbb2bbddf5e4e5fefd02501f930436f3f45402152d7ea9f8f27916d5cf70157",
strip_prefix = "boringssl-e8a935e323510419e0b37638716f6df4dcbbe6f6",
sha256 = "81333e496d7b74a60aa6fa622c028ba382a0a6b9c815cc6ccb221042383b9a9b",
strip_prefix = "boringssl-412844d75b14b9090b58423fd5f5ed8c2fd80212",
urls = [
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/e8a935e323510419e0b37638716f6df4dcbbe6f6.tar.gz",
"https://github.com/google/boringssl/archive/e8a935e323510419e0b37638716f6df4dcbbe6f6.tar.gz",
"https://storage.googleapis.com/grpc-bazel-mirror/github.com/google/boringssl/archive/412844d75b14b9090b58423fd5f5ed8c2fd80212.tar.gz",
"https://github.com/google/boringssl/archive/412844d75b14b9090b58423fd5f5ed8c2fd80212.tar.gz",
],
)

@ -100,6 +100,7 @@ libs:
- test/core/end2end/tests/retry_throttled.cc
- test/core/end2end/tests/retry_too_many_attempts.cc
- test/core/end2end/tests/server_finishes_request.cc
- test/core/end2end/tests/server_streaming.cc
- test/core/end2end/tests/shutdown_finishes_calls.cc
- test/core/end2end/tests/shutdown_finishes_tags.cc
- test/core/end2end/tests/simple_cacheable_request.cc
@ -209,6 +210,7 @@ libs:
- test/core/end2end/tests/retry_throttled.cc
- test/core/end2end/tests/retry_too_many_attempts.cc
- test/core/end2end/tests/server_finishes_request.cc
- test/core/end2end/tests/server_streaming.cc
- test/core/end2end/tests/shutdown_finishes_calls.cc
- test/core/end2end/tests/shutdown_finishes_tags.cc
- test/core/end2end/tests/simple_cacheable_request.cc
@ -399,7 +401,6 @@ libs:
- src/core/ext/filters/client_channel/lb_policy_factory.h
- src/core/ext/filters/client_channel/lb_policy_registry.h
- src/core/ext/filters/client_channel/local_subchannel_pool.h
- src/core/ext/filters/client_channel/parse_address.h
- src/core/ext/filters/client_channel/proxy_mapper.h
- src/core/ext/filters/client_channel/proxy_mapper_registry.h
- src/core/ext/filters/client_channel/resolver.h
@ -605,6 +606,7 @@ libs:
- src/core/lib/iomgr/load_file.h
- src/core/lib/iomgr/lockfree_event.h
- src/core/lib/iomgr/nameser.h
- src/core/lib/iomgr/parse_address.h
- src/core/lib/iomgr/poller/eventmanager_libuv.h
- src/core/lib/iomgr/polling_entity.h
- src/core/lib/iomgr/pollset.h
@ -649,6 +651,10 @@ libs:
- src/core/lib/iomgr/wakeup_fd_posix.h
- src/core/lib/iomgr/work_serializer.h
- src/core/lib/json/json.h
- src/core/lib/security/authorization/authorization_engine.h
- src/core/lib/security/authorization/evaluate_args.h
- src/core/lib/security/authorization/mock_cel/activation.h
- src/core/lib/security/authorization/mock_cel/cel_value.h
- src/core/lib/security/context/security_context.h
- src/core/lib/security/credentials/alts/alts_credentials.h
- src/core/lib/security/credentials/alts/check_gcp_environment.h
@ -776,7 +782,6 @@ libs:
- src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc
- src/core/ext/filters/client_channel/lb_policy_registry.cc
- src/core/ext/filters/client_channel/local_subchannel_pool.cc
- src/core/ext/filters/client_channel/parse_address.cc
- src/core/ext/filters/client_channel/proxy_mapper_registry.cc
- src/core/ext/filters/client_channel/resolver.cc
- src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@ -1001,6 +1006,7 @@ libs:
- src/core/lib/iomgr/is_epollexclusive_available.cc
- src/core/lib/iomgr/load_file.cc
- src/core/lib/iomgr/lockfree_event.cc
- src/core/lib/iomgr/parse_address.cc
- src/core/lib/iomgr/poller/eventmanager_libuv.cc
- src/core/lib/iomgr/polling_entity.cc
- src/core/lib/iomgr/pollset.cc
@ -1057,6 +1063,8 @@ libs:
- src/core/lib/iomgr/work_serializer.cc
- src/core/lib/json/json_reader.cc
- src/core/lib/json/json_writer.cc
- src/core/lib/security/authorization/authorization_engine.cc
- src/core/lib/security/authorization/evaluate_args.cc
- src/core/lib/security/context/security_context.cc
- src/core/lib/security/credentials/alts/alts_credentials.cc
- src/core/lib/security/credentials/alts/check_gcp_environment.cc
@ -1175,6 +1183,7 @@ libs:
- absl/strings:strings
- absl/status:status
- absl/container:inlined_vector
- absl/container:flat_hash_set
baselib: true
deps_linkage: static
dll: true
@ -1201,6 +1210,7 @@ libs:
headers:
- test/core/util/cmdline.h
- test/core/util/debugger_macros.h
- test/core/util/eval_args_mock_endpoint.h
- test/core/util/fuzzer_util.h
- test/core/util/grpc_profiler.h
- test/core/util/histogram.h
@ -1220,6 +1230,7 @@ libs:
src:
- test/core/util/cmdline.cc
- test/core/util/debugger_macros.cc
- test/core/util/eval_args_mock_endpoint.cc
- test/core/util/fuzzer_util.cc
- test/core/util/grpc_profiler.cc
- test/core/util/histogram.cc
@ -1250,6 +1261,7 @@ libs:
headers:
- test/core/util/cmdline.h
- test/core/util/debugger_macros.h
- test/core/util/eval_args_mock_endpoint.h
- test/core/util/fuzzer_util.h
- test/core/util/grpc_profiler.h
- test/core/util/histogram.h
@ -1269,6 +1281,7 @@ libs:
src:
- test/core/util/cmdline.cc
- test/core/util/debugger_macros.cc
- test/core/util/eval_args_mock_endpoint.cc
- test/core/util/fuzzer_util.cc
- test/core/util/grpc_profiler.cc
- test/core/util/histogram.cc
@ -1336,7 +1349,6 @@ libs:
- src/core/ext/filters/client_channel/lb_policy_factory.h
- src/core/ext/filters/client_channel/lb_policy_registry.h
- src/core/ext/filters/client_channel/local_subchannel_pool.h
- src/core/ext/filters/client_channel/parse_address.h
- src/core/ext/filters/client_channel/proxy_mapper.h
- src/core/ext/filters/client_channel/proxy_mapper_registry.h
- src/core/ext/filters/client_channel/resolver.h
@ -1539,6 +1551,7 @@ libs:
- src/core/lib/iomgr/load_file.h
- src/core/lib/iomgr/lockfree_event.h
- src/core/lib/iomgr/nameser.h
- src/core/lib/iomgr/parse_address.h
- src/core/lib/iomgr/poller/eventmanager_libuv.h
- src/core/lib/iomgr/polling_entity.h
- src/core/lib/iomgr/pollset.h
@ -1650,7 +1663,6 @@ libs:
- src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc
- src/core/ext/filters/client_channel/lb_policy_registry.cc
- src/core/ext/filters/client_channel/local_subchannel_pool.cc
- src/core/ext/filters/client_channel/parse_address.cc
- src/core/ext/filters/client_channel/proxy_mapper_registry.cc
- src/core/ext/filters/client_channel/resolver.cc
- src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc
@ -1869,6 +1881,7 @@ libs:
- src/core/lib/iomgr/is_epollexclusive_available.cc
- src/core/lib/iomgr/load_file.cc
- src/core/lib/iomgr/lockfree_event.cc
- src/core/lib/iomgr/parse_address.cc
- src/core/lib/iomgr/poller/eventmanager_libuv.cc
- src/core/lib/iomgr/polling_entity.cc
- src/core/lib/iomgr/pollset.cc
@ -2114,7 +2127,6 @@ libs:
- include/grpcpp/impl/codegen/client_callback.h
- include/grpcpp/impl/codegen/client_callback_impl.h
- include/grpcpp/impl/codegen/client_context.h
- include/grpcpp/impl/codegen/client_context_impl.h
- include/grpcpp/impl/codegen/client_interceptor.h
- include/grpcpp/impl/codegen/client_unary_call.h
- include/grpcpp/impl/codegen/completion_queue.h
@ -2491,7 +2503,6 @@ libs:
- include/grpcpp/impl/codegen/client_callback.h
- include/grpcpp/impl/codegen/client_callback_impl.h
- include/grpcpp/impl/codegen/client_context.h
- include/grpcpp/impl/codegen/client_context_impl.h
- include/grpcpp/impl/codegen/client_interceptor.h
- include/grpcpp/impl/codegen/client_unary_call.h
- include/grpcpp/impl/codegen/completion_queue.h
@ -3941,7 +3952,7 @@ targets:
language: c
headers: []
src:
- test/core/client_channel/parse_address_test.cc
- test/core/iomgr/parse_address_test.cc
deps:
- grpc_test_util
- grpc
@ -3953,7 +3964,7 @@ targets:
language: c
headers: []
src:
- test/core/client_channel/parse_address_with_named_scope_id_test.cc
- test/core/iomgr/parse_address_with_named_scope_id_test.cc
deps:
- grpc_test_util
- grpc
@ -4574,7 +4585,7 @@ targets:
language: c
headers: []
src:
- test/core/client_channel/uri_parser_test.cc
- test/core/uri/uri_parser_test.cc
deps:
- grpc_test_util
- grpc
@ -4767,12 +4778,8 @@ targets:
gtest: true
build: test
language: c++
headers:
- src/core/lib/security/authorization/authorization_engine.h
- src/core/lib/security/authorization/mock_cel/activation.h
- src/core/lib/security/authorization/mock_cel/cel_value.h
headers: []
src:
- src/core/lib/security/authorization/authorization_engine.cc
- test/core/security/authorization_engine_test.cc
deps:
- grpc_test_util
@ -5811,6 +5818,19 @@ targets:
- gpr
- address_sorting
- upb
- name: evaluate_args_test
gtest: true
build: test
language: c++
headers: []
src:
- test/core/security/evaluate_args_test.cc
deps:
- grpc_test_util
- grpc
- gpr
- address_sorting
- upb
- name: eventmanager_libuv_test
gtest: true
build: test
@ -7446,7 +7466,7 @@ targets:
language: c++
headers: []
src:
- test/core/client_channel/uri_fuzzer_test.cc
- test/core/uri/uri_fuzzer_test.cc
- test/core/util/fuzzer_corpus_test.cc
deps:
- grpc_test_util
@ -7456,7 +7476,7 @@ targets:
- address_sorting
- upb
corpus_dirs:
- test/core/client_channel/uri_corpus
- test/core/uri/uri_corpus
maxlen: 128
- name: window_overflow_bad_client_test
gtest: true
@ -7499,6 +7519,7 @@ targets:
headers:
- test/core/util/cmdline.h
- test/core/util/debugger_macros.h
- test/core/util/eval_args_mock_endpoint.h
- test/core/util/fuzzer_util.h
- test/core/util/grpc_profiler.h
- test/core/util/histogram.h
@ -7521,6 +7542,7 @@ targets:
- src/proto/grpc/testing/simple_messages.proto
- test/core/util/cmdline.cc
- test/core/util/debugger_macros.cc
- test/core/util/eval_args_mock_endpoint.cc
- test/core/util/fuzzer_util.cc
- test/core/util/grpc_profiler.cc
- test/core/util/histogram.cc

@ -70,7 +70,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc \
src/core/ext/filters/client_channel/lb_policy_registry.cc \
src/core/ext/filters/client_channel/local_subchannel_pool.cc \
src/core/ext/filters/client_channel/parse_address.cc \
src/core/ext/filters/client_channel/proxy_mapper_registry.cc \
src/core/ext/filters/client_channel/resolver.cc \
src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc \
@ -334,6 +333,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/iomgr/is_epollexclusive_available.cc \
src/core/lib/iomgr/load_file.cc \
src/core/lib/iomgr/lockfree_event.cc \
src/core/lib/iomgr/parse_address.cc \
src/core/lib/iomgr/poller/eventmanager_libuv.cc \
src/core/lib/iomgr/polling_entity.cc \
src/core/lib/iomgr/pollset.cc \
@ -392,6 +392,8 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/json/json_writer.cc \
src/core/lib/profiling/basic_timers.cc \
src/core/lib/profiling/stap_timers.cc \
src/core/lib/security/authorization/authorization_engine.cc \
src/core/lib/security/authorization/evaluate_args.cc \
src/core/lib/security/context/security_context.cc \
src/core/lib/security/credentials/alts/alts_credentials.cc \
src/core/lib/security/credentials/alts/check_gcp_environment.cc \
@ -514,6 +516,7 @@ if test "$PHP_GRPC" != "no"; then
src/php/ext/grpc/timeval.c \
third_party/abseil-cpp/absl/base/dynamic_annotations.cc \
third_party/abseil-cpp/absl/base/internal/cycleclock.cc \
third_party/abseil-cpp/absl/base/internal/exponential_biased.cc \
third_party/abseil-cpp/absl/base/internal/low_level_alloc.cc \
third_party/abseil-cpp/absl/base/internal/raw_logging.cc \
third_party/abseil-cpp/absl/base/internal/spinlock.cc \
@ -523,12 +526,17 @@ if test "$PHP_GRPC" != "no"; then
third_party/abseil-cpp/absl/base/internal/throw_delegate.cc \
third_party/abseil-cpp/absl/base/internal/unscaledcycleclock.cc \
third_party/abseil-cpp/absl/base/log_severity.cc \
third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc \
third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc \
third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc \
third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc \
third_party/abseil-cpp/absl/debugging/internal/demangle.cc \
third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.cc \
third_party/abseil-cpp/absl/debugging/internal/vdso_support.cc \
third_party/abseil-cpp/absl/debugging/stacktrace.cc \
third_party/abseil-cpp/absl/debugging/symbolize.cc \
third_party/abseil-cpp/absl/hash/internal/city.cc \
third_party/abseil-cpp/absl/hash/internal/hash.cc \
third_party/abseil-cpp/absl/numeric/int128.cc \
third_party/abseil-cpp/absl/status/status.cc \
third_party/abseil-cpp/absl/status/status_payload_printer.cc \
@ -579,6 +587,7 @@ if test "$PHP_GRPC" != "no"; then
third_party/abseil-cpp/absl/time/internal/cctz/src/zone_info_source.cc \
third_party/abseil-cpp/absl/time/time.cc \
third_party/abseil-cpp/absl/types/bad_optional_access.cc \
third_party/abseil-cpp/absl/types/bad_variant_access.cc \
third_party/address_sorting/address_sorting.c \
third_party/address_sorting/address_sorting_posix.c \
third_party/address_sorting/address_sorting_windows.c \
@ -691,6 +700,7 @@ if test "$PHP_GRPC" != "no"; then
third_party/boringssl-with-bazel/src/crypto/fipsmodule/fips_shared_support.c \
third_party/boringssl-with-bazel/src/crypto/fipsmodule/is_fips.c \
third_party/boringssl-with-bazel/src/crypto/hkdf/hkdf.c \
third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c \
third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c \
third_party/boringssl-with-bazel/src/crypto/lhash/lhash.c \
third_party/boringssl-with-bazel/src/crypto/mem.c \
@ -963,6 +973,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/iomgr/poller)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/json)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/profiling)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security/authorization)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security/context)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security/credentials)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security/credentials/alts)
@ -998,8 +1009,10 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/php/ext/grpc)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/base)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/base/internal)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/container/internal)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/debugging)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/debugging/internal)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/hash/internal)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/numeric)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/status)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/abseil-cpp/absl/strings)
@ -1035,6 +1048,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl-with-bazel/src/crypto/evp)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl-with-bazel/src/crypto/fipsmodule)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl-with-bazel/src/crypto/hkdf)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl-with-bazel/src/crypto/hpke)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl-with-bazel/src/crypto/hrss)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl-with-bazel/src/crypto/lhash)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/boringssl-with-bazel/src/crypto/obj)

@ -38,7 +38,6 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\client_channel\\lb_policy\\xds\\xds_routing.cc " +
"src\\core\\ext\\filters\\client_channel\\lb_policy_registry.cc " +
"src\\core\\ext\\filters\\client_channel\\local_subchannel_pool.cc " +
"src\\core\\ext\\filters\\client_channel\\parse_address.cc " +
"src\\core\\ext\\filters\\client_channel\\proxy_mapper_registry.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\dns\\c_ares\\dns_resolver_ares.cc " +
@ -302,6 +301,7 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\iomgr\\is_epollexclusive_available.cc " +
"src\\core\\lib\\iomgr\\load_file.cc " +
"src\\core\\lib\\iomgr\\lockfree_event.cc " +
"src\\core\\lib\\iomgr\\parse_address.cc " +
"src\\core\\lib\\iomgr\\poller\\eventmanager_libuv.cc " +
"src\\core\\lib\\iomgr\\polling_entity.cc " +
"src\\core\\lib\\iomgr\\pollset.cc " +
@ -360,6 +360,8 @@ if (PHP_GRPC != "no") {
"src\\core\\lib\\json\\json_writer.cc " +
"src\\core\\lib\\profiling\\basic_timers.cc " +
"src\\core\\lib\\profiling\\stap_timers.cc " +
"src\\core\\lib\\security\\authorization\\authorization_engine.cc " +
"src\\core\\lib\\security\\authorization\\evaluate_args.cc " +
"src\\core\\lib\\security\\context\\security_context.cc " +
"src\\core\\lib\\security\\credentials\\alts\\alts_credentials.cc " +
"src\\core\\lib\\security\\credentials\\alts\\check_gcp_environment.cc " +
@ -482,6 +484,7 @@ if (PHP_GRPC != "no") {
"src\\php\\ext\\grpc\\timeval.c " +
"third_party\\abseil-cpp\\absl\\base\\dynamic_annotations.cc " +
"third_party\\abseil-cpp\\absl\\base\\internal\\cycleclock.cc " +
"third_party\\abseil-cpp\\absl\\base\\internal\\exponential_biased.cc " +
"third_party\\abseil-cpp\\absl\\base\\internal\\low_level_alloc.cc " +
"third_party\\abseil-cpp\\absl\\base\\internal\\raw_logging.cc " +
"third_party\\abseil-cpp\\absl\\base\\internal\\spinlock.cc " +
@ -491,12 +494,17 @@ if (PHP_GRPC != "no") {
"third_party\\abseil-cpp\\absl\\base\\internal\\throw_delegate.cc " +
"third_party\\abseil-cpp\\absl\\base\\internal\\unscaledcycleclock.cc " +
"third_party\\abseil-cpp\\absl\\base\\log_severity.cc " +
"third_party\\abseil-cpp\\absl\\container\\internal\\hashtablez_sampler.cc " +
"third_party\\abseil-cpp\\absl\\container\\internal\\hashtablez_sampler_force_weak_definition.cc " +
"third_party\\abseil-cpp\\absl\\container\\internal\\raw_hash_set.cc " +
"third_party\\abseil-cpp\\absl\\debugging\\internal\\address_is_readable.cc " +
"third_party\\abseil-cpp\\absl\\debugging\\internal\\demangle.cc " +
"third_party\\abseil-cpp\\absl\\debugging\\internal\\elf_mem_image.cc " +
"third_party\\abseil-cpp\\absl\\debugging\\internal\\vdso_support.cc " +
"third_party\\abseil-cpp\\absl\\debugging\\stacktrace.cc " +
"third_party\\abseil-cpp\\absl\\debugging\\symbolize.cc " +
"third_party\\abseil-cpp\\absl\\hash\\internal\\city.cc " +
"third_party\\abseil-cpp\\absl\\hash\\internal\\hash.cc " +
"third_party\\abseil-cpp\\absl\\numeric\\int128.cc " +
"third_party\\abseil-cpp\\absl\\status\\status.cc " +
"third_party\\abseil-cpp\\absl\\status\\status_payload_printer.cc " +
@ -547,6 +555,7 @@ if (PHP_GRPC != "no") {
"third_party\\abseil-cpp\\absl\\time\\internal\\cctz\\src\\zone_info_source.cc " +
"third_party\\abseil-cpp\\absl\\time\\time.cc " +
"third_party\\abseil-cpp\\absl\\types\\bad_optional_access.cc " +
"third_party\\abseil-cpp\\absl\\types\\bad_variant_access.cc " +
"third_party\\address_sorting\\address_sorting.c " +
"third_party\\address_sorting\\address_sorting_posix.c " +
"third_party\\address_sorting\\address_sorting_windows.c " +
@ -659,6 +668,7 @@ if (PHP_GRPC != "no") {
"third_party\\boringssl-with-bazel\\src\\crypto\\fipsmodule\\fips_shared_support.c " +
"third_party\\boringssl-with-bazel\\src\\crypto\\fipsmodule\\is_fips.c " +
"third_party\\boringssl-with-bazel\\src\\crypto\\hkdf\\hkdf.c " +
"third_party\\boringssl-with-bazel\\src\\crypto\\hpke\\hpke.c " +
"third_party\\boringssl-with-bazel\\src\\crypto\\hrss\\hrss.c " +
"third_party\\boringssl-with-bazel\\src\\crypto\\lhash\\lhash.c " +
"third_party\\boringssl-with-bazel\\src\\crypto\\mem.c " +
@ -1006,6 +1016,7 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\json");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\profiling");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\authorization");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\context");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\lib\\security\\credentials\\alts");
@ -1048,8 +1059,12 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\base");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\base\\internal");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\container");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\container\\internal");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\debugging");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\debugging\\internal");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\hash");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\hash\\internal");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\numeric");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\status");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\abseil-cpp\\absl\\strings");
@ -1088,6 +1103,7 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl-with-bazel\\src\\crypto\\evp");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl-with-bazel\\src\\crypto\\fipsmodule");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl-with-bazel\\src\\crypto\\hkdf");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl-with-bazel\\src\\crypto\\hpke");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl-with-bazel\\src\\crypto\\hrss");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl-with-bazel\\src\\crypto\\lhash");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\third_party\\boringssl-with-bazel\\src\\crypto\\obj");

@ -187,3 +187,10 @@ Compression
^^^^^^^^^^^
.. autoclass:: Compression
Runtime Protobuf Parsing
^^^^^^^^^^^^^^^^^^^^^^^^
.. autofunction:: protos
.. autofunction:: services
.. autofunction:: protos_and_services

@ -36,6 +36,9 @@ Electron | n/a | all | :heavy_check_mark:
ObjC | Yes | iOS | :x:
PHP | Yes | all | Same as the `Makefile` case from above
PHP | No | all | :x:
Python | n/a | all | :x:
Python | n/a | Linux, 64bit | :heavy_check_mark:
Python | n/a | Linux, 32bit | :x:
Python | n/a | MacOS, 64bit | :heavy_check_mark:
Python | n/a | MacOS, 32bit | :x:
Python | n/a | Windows | :x:
Ruby | No | all | :x:

@ -3,11 +3,12 @@ Ordering Status and Reads in the gRPC API
Rules for implementors:
1. Reads and Writes Must not succeed after Status has been delivered.
2. OK Status is only delivered after all buffered messages are read.
2. Status is only delivered after all buffered messages are read.
3. Reads May continue to succeed after a failing write.
However, once a write fails, all subsequent writes Must fail,
and similarly, once a read fails, all subsequent reads Must fail.
4. When an error status is known to the library, if the user asks for status,
4. A non-OK status received from the server is not considered an error status.
5. When an error status is known to the library, if the user asks for status,
the library Should discard messages received in the library but not delivered
to the user and then deliver the status. If the user does not ask for status
but continues reading, the library Should deliver buffered messages before

@ -22,7 +22,7 @@ namespace GreeterClient
{
public static void Main(string[] args)
{
Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
Channel channel = new Channel("127.0.0.1:30051", ChannelCredentials.Insecure);
var client = new Greeter.GreeterClient(channel);
String user = "you";

@ -30,7 +30,7 @@ namespace GreeterServer
class Program
{
const int Port = 50051;
const int Port = 30051;
public static void Main(string[] args)
{

@ -22,7 +22,7 @@ namespace GreeterClient
{
public static void Main(string[] args)
{
Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
Channel channel = new Channel("127.0.0.1:30051", ChannelCredentials.Insecure);
var client = new Greeter.GreeterClient(channel);
String user = "you";

@ -30,7 +30,7 @@ namespace GreeterServer
class Program
{
const int Port = 50051;
const int Port = 30051;
public static void Main(string[] args)
{

@ -48,7 +48,7 @@ class HelloWorldTest
public static HelloReply Greet(string greeting)
{
const int Port = 50051;
const int Port = 30051;
Server server = new Server
{
@ -57,7 +57,7 @@ class HelloWorldTest
};
server.Start();
Channel channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
Channel channel = new Channel("127.0.0.1:30051", ChannelCredentials.Insecure);
var client = new Greeter.GreeterClient(channel);

@ -28,7 +28,7 @@ namespace HelloworldXamarin.Droid
[Activity(Label = "HelloworldXamarin", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
const int Port = 50051;
const int Port = 30051;
int count = 1;
protected override void OnCreate(Bundle savedInstanceState)
@ -55,8 +55,8 @@ namespace HelloworldXamarin.Droid
server.Start();
// use loopback on host machine: https://developer.android.com/studio/run/emulator-networking
//10.0.2.2:50051
Channel channel = new Channel("localhost:50051", ChannelCredentials.Insecure);
//10.0.2.2:30051
Channel channel = new Channel("localhost:30051", ChannelCredentials.Insecure);
var client = new Greeter.GreeterClient(channel);
string user = "Xamarin " + count;

@ -28,7 +28,7 @@ namespace HelloworldXamarin.iOS
{
public partial class ViewController : UIViewController
{
const int Port = 50051;
const int Port = 30051;
int count = 1;
public ViewController(IntPtr handle) : base(handle)
@ -42,7 +42,7 @@ namespace HelloworldXamarin.iOS
// Perform any additional setup after loading the view, typically from a nib.
Button.AccessibilityIdentifier = "myButton";
Button.TouchUpInside += delegate
{
{
var title = SayHello();
Button.SetTitle(title, UIControlState.Normal);
};
@ -63,7 +63,7 @@ namespace HelloworldXamarin.iOS
};
server.Start();
Channel channel = new Channel("localhost:50051", ChannelCredentials.Insecure);
Channel channel = new Channel("localhost:30051", ChannelCredentials.Insecure);
var client = new Greeter.GreeterClient(channel);
string user = "Xamarin " + count;

@ -215,7 +215,7 @@ namespace Routeguide
static void Main(string[] args)
{
var channel = new Channel("127.0.0.1:50052", ChannelCredentials.Insecure);
var channel = new Channel("127.0.0.1:30052", ChannelCredentials.Insecure);
var client = new RouteGuideClient(new RouteGuide.RouteGuideClient(channel));
// Looking for a valid feature

@ -25,7 +25,7 @@ namespace Routeguide
{
static void Main(string[] args)
{
const int Port = 50052;
const int Port = 30052;
var features = RouteGuideUtil.LoadFeatures();

@ -23,7 +23,7 @@ namespace GreeterClient
{
private class Options
{
[Option("server", Default = "localhost:50051", HelpText = "The address of the server")]
[Option("server", Default = "localhost:30051", HelpText = "The address of the server")]
public string Server { get; set; }
}

@ -46,7 +46,7 @@ namespace GreeterServer
{
class Options
{
[Option("port", Default = 50051, HelpText = "The port to listen on.")]
[Option("port", Default = 30051, HelpText = "The port to listen on.")]
public int Port { get; set; }
[Option("hostname", Required = false, HelpText = "The name clients will see in responses. If not specified, machine's hostname will obtain automatically.")]

@ -67,7 +67,7 @@ you to manually test the service.
Exercise your server's application-layer service:
```sh
> grpcurl --plaintext -d '{"name": "you"}' localhost:50051
> grpcurl --plaintext -d '{"name": "you"}' localhost:30051
{
"message": "Hello you from jtatt.muc.corp.google.com!"
}
@ -76,7 +76,7 @@ Exercise your server's application-layer service:
Make sure that all of your server's services are available via reflection:
```sh
> grpcurl --plaintext localhost:50051 list
> grpcurl --plaintext localhost:30051 list
grpc.health.v1.Health
grpc.reflection.v1alpha.ServerReflection
helloworld.Greeter
@ -85,13 +85,13 @@ helloworld.Greeter
Make sure that your services are reporting healthy:
```sh
> grpcurl --plaintext -d '{"service": "helloworld.Greeter"}' localhost:50051
> grpcurl --plaintext -d '{"service": "helloworld.Greeter"}' localhost:30051
grpc.health.v1.Health/Check
{
"status": "SERVING"
}
> grpcurl --plaintext -d '{"service": ""}' localhost:50051
> grpcurl --plaintext -d '{"service": ""}' localhost:30051
grpc.health.v1.Health/Check
{
"status": "SERVING"

@ -0,0 +1,40 @@
# Copyright 2020 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.
"""Hello World without using protoc.
This example parses message and service schemas directly from a
.proto file on the filesystem.
Several APIs used in this example are in an experimental state.
"""
from __future__ import print_function
import logging
import grpc
import grpc.experimental
# NOTE: The path to the .proto file must be reachable from an entry
# on sys.path. Use sys.path.insert or set the $PYTHONPATH variable to
# import from files located elsewhere on the filesystem.
protos = grpc.protos("helloworld.proto")
services = grpc.services("helloworld.proto")
logging.basicConfig()
response = services.Greeter.SayHello(protos.HelloRequest(name='you'),
'localhost:50051',
insecure=True)
print("Greeter client received: " + response.message)

@ -0,0 +1,40 @@
# Copyright 2020 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.
"""The Python implementation of the GRPC helloworld.Greeter server."""
from concurrent import futures
import logging
import grpc
protos, services = grpc.protos_and_services("helloworld.proto")
class Greeter(services.GreeterServicer):
def SayHello(self, request, context):
return protos.HelloReply(message='Hello, %s!' % request.name)
def serve():
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
services.add_GreeterServicer_to_server(Greeter(), server)
server.add_insecure_port('[::]:50051')
server.start()
server.wait_for_termination()
if __name__ == '__main__':
logging.basicConfig()
serve()

@ -0,0 +1,38 @@
// Copyright 2020 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.
syntax = "proto3";
option java_multiple_files = true;
option java_package = "io.grpc.examples.helloworld";
option java_outer_classname = "HelloWorldProto";
option objc_class_prefix = "HLW";
package helloworld;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply) {}
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}

@ -106,7 +106,6 @@ Pod::Spec.new do |s|
'include/grpcpp/impl/codegen/client_callback.h',
'include/grpcpp/impl/codegen/client_callback_impl.h',
'include/grpcpp/impl/codegen/client_context.h',
'include/grpcpp/impl/codegen/client_context_impl.h',
'include/grpcpp/impl/codegen/client_interceptor.h',
'include/grpcpp/impl/codegen/client_unary_call.h',
'include/grpcpp/impl/codegen/completion_queue.h',
@ -202,6 +201,7 @@ Pod::Spec.new do |s|
ss.dependency 'gRPC-Core', version
abseil_version = '1.20200225.0'
ss.dependency 'abseil/base/base', abseil_version
ss.dependency 'abseil/container/flat_hash_set', abseil_version
ss.dependency 'abseil/container/inlined_vector', abseil_version
ss.dependency 'abseil/memory/memory', abseil_version
ss.dependency 'abseil/status/status', abseil_version
@ -236,7 +236,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy_factory.h',
'src/core/ext/filters/client_channel/lb_policy_registry.h',
'src/core/ext/filters/client_channel/local_subchannel_pool.h',
'src/core/ext/filters/client_channel/parse_address.h',
'src/core/ext/filters/client_channel/proxy_mapper.h',
'src/core/ext/filters/client_channel/proxy_mapper_registry.h',
'src/core/ext/filters/client_channel/resolver.h',
@ -469,6 +468,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/parse_address.h',
'src/core/lib/iomgr/poller/eventmanager_libuv.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
@ -514,6 +514,10 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/work_serializer.h',
'src/core/lib/json/json.h',
'src/core/lib/profiling/timers.h',
'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/evaluate_args.h',
'src/core/lib/security/authorization/mock_cel/activation.h',
'src/core/lib/security/authorization/mock_cel/cel_value.h',
'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h',
@ -726,7 +730,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy_factory.h',
'src/core/ext/filters/client_channel/lb_policy_registry.h',
'src/core/ext/filters/client_channel/local_subchannel_pool.h',
'src/core/ext/filters/client_channel/parse_address.h',
'src/core/ext/filters/client_channel/proxy_mapper.h',
'src/core/ext/filters/client_channel/proxy_mapper_registry.h',
'src/core/ext/filters/client_channel/resolver.h',
@ -959,6 +962,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/parse_address.h',
'src/core/lib/iomgr/poller/eventmanager_libuv.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
@ -1004,6 +1008,10 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/work_serializer.h',
'src/core/lib/json/json.h',
'src/core/lib/profiling/timers.h',
'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/evaluate_args.h',
'src/core/lib/security/authorization/mock_cel/activation.h',
'src/core/lib/security/authorization/mock_cel/cel_value.h',
'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h',

@ -172,9 +172,10 @@ Pod::Spec.new do |s|
ss.header_mappings_dir = '.'
ss.libraries = 'z'
ss.dependency "#{s.name}/Interface", version
ss.dependency 'BoringSSL-GRPC', '0.0.11'
ss.dependency 'BoringSSL-GRPC', '0.0.12'
abseil_version = '1.20200225.0'
ss.dependency 'abseil/base/base', abseil_version
ss.dependency 'abseil/container/flat_hash_set', abseil_version
ss.dependency 'abseil/container/inlined_vector', abseil_version
ss.dependency 'abseil/memory/memory', abseil_version
ss.dependency 'abseil/status/status', abseil_version
@ -242,8 +243,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy_registry.h',
'src/core/ext/filters/client_channel/local_subchannel_pool.cc',
'src/core/ext/filters/client_channel/local_subchannel_pool.h',
'src/core/ext/filters/client_channel/parse_address.cc',
'src/core/ext/filters/client_channel/parse_address.h',
'src/core/ext/filters/client_channel/proxy_mapper.h',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.h',
@ -739,6 +738,8 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/lockfree_event.cc',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/parse_address.cc',
'src/core/lib/iomgr/parse_address.h',
'src/core/lib/iomgr/poller/eventmanager_libuv.cc',
'src/core/lib/iomgr/poller/eventmanager_libuv.h',
'src/core/lib/iomgr/polling_entity.cc',
@ -842,6 +843,12 @@ Pod::Spec.new do |s|
'src/core/lib/profiling/basic_timers.cc',
'src/core/lib/profiling/stap_timers.cc',
'src/core/lib/profiling/timers.h',
'src/core/lib/security/authorization/authorization_engine.cc',
'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/evaluate_args.cc',
'src/core/lib/security/authorization/evaluate_args.h',
'src/core/lib/security/authorization/mock_cel/activation.h',
'src/core/lib/security/authorization/mock_cel/cel_value.h',
'src/core/lib/security/context/security_context.cc',
'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.cc',
@ -1134,7 +1141,6 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/lb_policy_factory.h',
'src/core/ext/filters/client_channel/lb_policy_registry.h',
'src/core/ext/filters/client_channel/local_subchannel_pool.h',
'src/core/ext/filters/client_channel/parse_address.h',
'src/core/ext/filters/client_channel/proxy_mapper.h',
'src/core/ext/filters/client_channel/proxy_mapper_registry.h',
'src/core/ext/filters/client_channel/resolver.h',
@ -1367,6 +1373,7 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/parse_address.h',
'src/core/lib/iomgr/poller/eventmanager_libuv.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
@ -1412,6 +1419,10 @@ Pod::Spec.new do |s|
'src/core/lib/iomgr/work_serializer.h',
'src/core/lib/json/json.h',
'src/core/lib/profiling/timers.h',
'src/core/lib/security/authorization/authorization_engine.h',
'src/core/lib/security/authorization/evaluate_args.h',
'src/core/lib/security/authorization/mock_cel/activation.h',
'src/core/lib/security/authorization/mock_cel/cel_value.h',
'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h',
@ -1654,6 +1665,7 @@ Pod::Spec.new do |s|
'test/core/end2end/tests/retry_throttled.cc',
'test/core/end2end/tests/retry_too_many_attempts.cc',
'test/core/end2end/tests/server_finishes_request.cc',
'test/core/end2end/tests/server_streaming.cc',
'test/core/end2end/tests/shutdown_finishes_calls.cc',
'test/core/end2end/tests/shutdown_finishes_tags.cc',
'test/core/end2end/tests/simple_cacheable_request.cc',
@ -1672,6 +1684,8 @@ Pod::Spec.new do |s|
'test/core/util/cmdline.h',
'test/core/util/debugger_macros.cc',
'test/core/util/debugger_macros.h',
'test/core/util/eval_args_mock_endpoint.cc',
'test/core/util/eval_args_mock_endpoint.h',
'test/core/util/fuzzer_util.cc',
'test/core/util/fuzzer_util.h',
'test/core/util/grpc_profiler.cc',

@ -161,8 +161,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/client_channel/lb_policy_registry.h )
s.files += %w( src/core/ext/filters/client_channel/local_subchannel_pool.cc )
s.files += %w( src/core/ext/filters/client_channel/local_subchannel_pool.h )
s.files += %w( src/core/ext/filters/client_channel/parse_address.cc )
s.files += %w( src/core/ext/filters/client_channel/parse_address.h )
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper.h )
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper_registry.cc )
s.files += %w( src/core/ext/filters/client_channel/proxy_mapper_registry.h )
@ -658,6 +656,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/iomgr/lockfree_event.cc )
s.files += %w( src/core/lib/iomgr/lockfree_event.h )
s.files += %w( src/core/lib/iomgr/nameser.h )
s.files += %w( src/core/lib/iomgr/parse_address.cc )
s.files += %w( src/core/lib/iomgr/parse_address.h )
s.files += %w( src/core/lib/iomgr/poller/eventmanager_libuv.cc )
s.files += %w( src/core/lib/iomgr/poller/eventmanager_libuv.h )
s.files += %w( src/core/lib/iomgr/polling_entity.cc )
@ -761,6 +761,12 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/profiling/basic_timers.cc )
s.files += %w( src/core/lib/profiling/stap_timers.cc )
s.files += %w( src/core/lib/profiling/timers.h )
s.files += %w( src/core/lib/security/authorization/authorization_engine.cc )
s.files += %w( src/core/lib/security/authorization/authorization_engine.h )
s.files += %w( src/core/lib/security/authorization/evaluate_args.cc )
s.files += %w( src/core/lib/security/authorization/evaluate_args.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/activation.h )
s.files += %w( src/core/lib/security/authorization/mock_cel/cel_value.h )
s.files += %w( src/core/lib/security/context/security_context.cc )
s.files += %w( src/core/lib/security/context/security_context.h )
s.files += %w( src/core/lib/security/credentials/alts/alts_credentials.cc )
@ -966,6 +972,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/tsi/transport_security_grpc.h )
s.files += %w( src/core/tsi/transport_security_interface.h )
s.files += %w( third_party/abseil-cpp/absl/algorithm/algorithm.h )
s.files += %w( third_party/abseil-cpp/absl/algorithm/container.h )
s.files += %w( third_party/abseil-cpp/absl/base/attributes.h )
s.files += %w( third_party/abseil-cpp/absl/base/call_once.h )
s.files += %w( third_party/abseil-cpp/absl/base/casts.h )
@ -980,6 +987,8 @@ Gem::Specification.new do |s|
s.files += %w( third_party/abseil-cpp/absl/base/internal/direct_mmap.h )
s.files += %w( third_party/abseil-cpp/absl/base/internal/endian.h )
s.files += %w( third_party/abseil-cpp/absl/base/internal/errno_saver.h )
s.files += %w( third_party/abseil-cpp/absl/base/internal/exponential_biased.cc )
s.files += %w( third_party/abseil-cpp/absl/base/internal/exponential_biased.h )
s.files += %w( third_party/abseil-cpp/absl/base/internal/hide_ptr.h )
s.files += %w( third_party/abseil-cpp/absl/base/internal/identity.h )
s.files += %w( third_party/abseil-cpp/absl/base/internal/inline_variable.h )
@ -1019,9 +1028,22 @@ Gem::Specification.new do |s|
s.files += %w( third_party/abseil-cpp/absl/base/port.h )
s.files += %w( third_party/abseil-cpp/absl/base/thread_annotations.h )
s.files += %w( third_party/abseil-cpp/absl/container/fixed_array.h )
s.files += %w( third_party/abseil-cpp/absl/container/flat_hash_set.h )
s.files += %w( third_party/abseil-cpp/absl/container/inlined_vector.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/common.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/compressed_tuple.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/container_memory.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc )
s.files += %w( third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc )
s.files += %w( third_party/abseil-cpp/absl/container/internal/have_sse.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/inlined_vector.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/layout.h )
s.files += %w( third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc )
s.files += %w( third_party/abseil-cpp/absl/container/internal/raw_hash_set.h )
s.files += %w( third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc )
s.files += %w( third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h )
s.files += %w( third_party/abseil-cpp/absl/debugging/internal/demangle.cc )
@ -1048,6 +1070,11 @@ Gem::Specification.new do |s|
s.files += %w( third_party/abseil-cpp/absl/debugging/symbolize_win32.inc )
s.files += %w( third_party/abseil-cpp/absl/functional/function_ref.h )
s.files += %w( third_party/abseil-cpp/absl/functional/internal/function_ref.h )
s.files += %w( third_party/abseil-cpp/absl/hash/hash.h )
s.files += %w( third_party/abseil-cpp/absl/hash/internal/city.cc )
s.files += %w( third_party/abseil-cpp/absl/hash/internal/city.h )
s.files += %w( third_party/abseil-cpp/absl/hash/internal/hash.cc )
s.files += %w( third_party/abseil-cpp/absl/hash/internal/hash.h )
s.files += %w( third_party/abseil-cpp/absl/memory/memory.h )
s.files += %w( third_party/abseil-cpp/absl/meta/type_traits.h )
s.files += %w( third_party/abseil-cpp/absl/numeric/int128.cc )
@ -1165,10 +1192,14 @@ Gem::Specification.new do |s|
s.files += %w( third_party/abseil-cpp/absl/time/time.h )
s.files += %w( third_party/abseil-cpp/absl/types/bad_optional_access.cc )
s.files += %w( third_party/abseil-cpp/absl/types/bad_optional_access.h )
s.files += %w( third_party/abseil-cpp/absl/types/bad_variant_access.cc )
s.files += %w( third_party/abseil-cpp/absl/types/bad_variant_access.h )
s.files += %w( third_party/abseil-cpp/absl/types/internal/optional.h )
s.files += %w( third_party/abseil-cpp/absl/types/internal/span.h )
s.files += %w( third_party/abseil-cpp/absl/types/internal/variant.h )
s.files += %w( third_party/abseil-cpp/absl/types/optional.h )
s.files += %w( third_party/abseil-cpp/absl/types/span.h )
s.files += %w( third_party/abseil-cpp/absl/types/variant.h )
s.files += %w( third_party/abseil-cpp/absl/utility/utility.h )
s.files += %w( third_party/address_sorting/address_sorting.c )
s.files += %w( third_party/address_sorting/address_sorting_internal.h )
@ -1388,6 +1419,8 @@ Gem::Specification.new do |s|
s.files += %w( third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h )
s.files += %w( third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/kdf.c )
s.files += %w( third_party/boringssl-with-bazel/src/crypto/hkdf/hkdf.c )
s.files += %w( third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c )
s.files += %w( third_party/boringssl-with-bazel/src/crypto/hpke/internal.h )
s.files += %w( third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c )
s.files += %w( third_party/boringssl-with-bazel/src/crypto/hrss/internal.h )
s.files += %w( third_party/boringssl-with-bazel/src/crypto/internal.h )

@ -252,6 +252,7 @@
'test/core/end2end/tests/retry_throttled.cc',
'test/core/end2end/tests/retry_too_many_attempts.cc',
'test/core/end2end/tests/server_finishes_request.cc',
'test/core/end2end/tests/server_streaming.cc',
'test/core/end2end/tests/shutdown_finishes_calls.cc',
'test/core/end2end/tests/shutdown_finishes_tags.cc',
'test/core/end2end/tests/simple_cacheable_request.cc',
@ -354,6 +355,7 @@
'test/core/end2end/tests/retry_throttled.cc',
'test/core/end2end/tests/retry_too_many_attempts.cc',
'test/core/end2end/tests/server_finishes_request.cc',
'test/core/end2end/tests/server_streaming.cc',
'test/core/end2end/tests/shutdown_finishes_calls.cc',
'test/core/end2end/tests/shutdown_finishes_tags.cc',
'test/core/end2end/tests/simple_cacheable_request.cc',
@ -436,6 +438,7 @@
'absl/strings:strings',
'absl/status:status',
'absl/container:inlined_vector',
'absl/container:flat_hash_set',
],
'sources': [
'src/core/ext/filters/census/grpc_context.cc',
@ -470,7 +473,6 @@
'src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc',
'src/core/ext/filters/client_channel/lb_policy_registry.cc',
'src/core/ext/filters/client_channel/local_subchannel_pool.cc',
'src/core/ext/filters/client_channel/parse_address.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/resolver.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc',
@ -695,6 +697,7 @@
'src/core/lib/iomgr/is_epollexclusive_available.cc',
'src/core/lib/iomgr/load_file.cc',
'src/core/lib/iomgr/lockfree_event.cc',
'src/core/lib/iomgr/parse_address.cc',
'src/core/lib/iomgr/poller/eventmanager_libuv.cc',
'src/core/lib/iomgr/polling_entity.cc',
'src/core/lib/iomgr/pollset.cc',
@ -751,6 +754,8 @@
'src/core/lib/iomgr/work_serializer.cc',
'src/core/lib/json/json_reader.cc',
'src/core/lib/json/json_writer.cc',
'src/core/lib/security/authorization/authorization_engine.cc',
'src/core/lib/security/authorization/evaluate_args.cc',
'src/core/lib/security/context/security_context.cc',
'src/core/lib/security/credentials/alts/alts_credentials.cc',
'src/core/lib/security/credentials/alts/check_gcp_environment.cc',
@ -888,6 +893,7 @@
'sources': [
'test/core/util/cmdline.cc',
'test/core/util/debugger_macros.cc',
'test/core/util/eval_args_mock_endpoint.cc',
'test/core/util/fuzzer_util.cc',
'test/core/util/grpc_profiler.cc',
'test/core/util/histogram.cc',
@ -920,6 +926,7 @@
'sources': [
'test/core/util/cmdline.cc',
'test/core/util/debugger_macros.cc',
'test/core/util/eval_args_mock_endpoint.cc',
'test/core/util/fuzzer_util.cc',
'test/core/util/grpc_profiler.cc',
'test/core/util/histogram.cc',
@ -985,7 +992,6 @@
'src/core/ext/filters/client_channel/lb_policy/xds/xds_routing.cc',
'src/core/ext/filters/client_channel/lb_policy_registry.cc',
'src/core/ext/filters/client_channel/local_subchannel_pool.cc',
'src/core/ext/filters/client_channel/parse_address.cc',
'src/core/ext/filters/client_channel/proxy_mapper_registry.cc',
'src/core/ext/filters/client_channel/resolver.cc',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/dns_resolver_ares.cc',
@ -1204,6 +1210,7 @@
'src/core/lib/iomgr/is_epollexclusive_available.cc',
'src/core/lib/iomgr/load_file.cc',
'src/core/lib/iomgr/lockfree_event.cc',
'src/core/lib/iomgr/parse_address.cc',
'src/core/lib/iomgr/poller/eventmanager_libuv.cc',
'src/core/lib/iomgr/polling_entity.cc',
'src/core/lib/iomgr/pollset.cc',
@ -1674,6 +1681,7 @@
'third_party/boringssl-with-bazel/src/crypto/fipsmodule/fips_shared_support.c',
'third_party/boringssl-with-bazel/src/crypto/fipsmodule/is_fips.c',
'third_party/boringssl-with-bazel/src/crypto/hkdf/hkdf.c',
'third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c',
'third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c',
'third_party/boringssl-with-bazel/src/crypto/lhash/lhash.c',
'third_party/boringssl-with-bazel/src/crypto/mem.c',

@ -0,0 +1,22 @@
# Welcome to `include/grpc/impl/codegen`
## Why is this directory here?
This directory exists so that generated C++ code can include selected files upon
which it depends without having to depend on the entire gRPC C++ library. This
directory thus exists to support `include/grpcpp/impl/codegen`. This constraint
is particularly relevant for users of bazel, particularly if they use the
multi-lingual `proto_library` target type. Generated code that uses this target
only depends on the gRPC C++ targets associated with these header files, not the
entire gRPC C++ codebase since that would make the build time of these types of
targets excessively large (particularly when they are not even C++ specific).
## What should user code do?
User code should *not* include anything from this directory. Only generated code
and gRPC library code should include contents from this directory. C++ user code
should instead include contents from the main `grpcpp` directory or its
accessible subcomponents like `grpcpp/support`. It is possible that we may
remove this directory altogether if the motivations for its existence are no
longer strong enough (e.g., if the gRPC C++ library no longer has a need for an
`impl/codegen` directory of its own).

@ -86,7 +86,7 @@ class Channel final : public ::grpc::ChannelInterface,
interceptor_creators);
::grpc::internal::Call CreateCall(const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
::grpc::CompletionQueue* cq) override;
void PerformOpsOnCall(::grpc::internal::CallOpSetInterface* ops,
::grpc::internal::Call* call) override;
@ -101,9 +101,8 @@ class Channel final : public ::grpc::ChannelInterface,
::grpc::CompletionQueue* CallbackCQ() override;
::grpc::internal::Call CreateCallInternal(
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context, ::grpc::CompletionQueue* cq,
size_t interceptor_pos) override;
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
::grpc::CompletionQueue* cq, size_t interceptor_pos) override;
const std::string host_;
grpc_channel* const c_channel_; // owned

@ -0,0 +1,21 @@
# Welcome to `include/grpcpp/impl/codegen`
## Why is this directory here?
This directory exists so that generated code can include selected files upon
which it depends without having to depend on the entire gRPC C++ library. This
is particularly relevant for users of bazel, particularly if they use the
multi-lingual `proto_library` target type. Generated code that uses this target
only depends on the gRPC C++ targets associated with these header files, not the
entire gRPC C++ codebase since that would make the build time of these types of
targets excessively large (particularly when they are not even C++ specific).
## What should user code do?
User code should *not* include anything from this directory. Only generated code
and gRPC library code should include contents from this directory. User code
should instead include contents from the main `grpcpp` directory or its
accessible subcomponents like `grpcpp/support`. It is possible that we may
remove this directory altogether if the motivations for its existence are no
longer strong enough (e.g., if most users migrate away from the `proto_library`
target type or if the additional overhead of depending on gRPC C++ is not high).

@ -180,7 +180,7 @@ class ClientAsyncReaderFactory {
static ClientAsyncReader<R>* Create(::grpc::ChannelInterface* channel,
::grpc::CompletionQueue* cq,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
const W& request, bool start, void* tag) {
::grpc::internal::Call call = channel->CreateCall(method, context, cq);
return new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
@ -259,9 +259,8 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
private:
friend class internal::ClientAsyncReaderFactory<R>;
template <class W>
ClientAsyncReader(::grpc::internal::Call call,
::grpc_impl::ClientContext* context, const W& request,
bool start, void* tag)
ClientAsyncReader(::grpc::internal::Call call, ::grpc::ClientContext* context,
const W& request, bool start, void* tag)
: context_(context), call_(call), started_(start) {
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok());
@ -280,7 +279,7 @@ class ClientAsyncReader final : public ClientAsyncReaderInterface<R> {
call_.PerformOps(&init_ops_);
}
::grpc_impl::ClientContext* context_;
::grpc::ClientContext* context_;
::grpc::internal::Call call_;
bool started_;
::grpc::internal::CallOpSet<::grpc::internal::CallOpSendInitialMetadata,
@ -329,7 +328,7 @@ class ClientAsyncWriterFactory {
static ClientAsyncWriter<W>* Create(::grpc::ChannelInterface* channel,
::grpc::CompletionQueue* cq,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
R* response, bool start, void* tag) {
::grpc::internal::Call call = channel->CreateCall(method, context, cq);
return new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
@ -426,9 +425,8 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
private:
friend class internal::ClientAsyncWriterFactory<W>;
template <class R>
ClientAsyncWriter(::grpc::internal::Call call,
::grpc_impl::ClientContext* context, R* response,
bool start, void* tag)
ClientAsyncWriter(::grpc::internal::Call call, ::grpc::ClientContext* context,
R* response, bool start, void* tag)
: context_(context), call_(call), started_(start) {
finish_ops_.RecvMessage(response);
finish_ops_.AllowNoMessage();
@ -450,7 +448,7 @@ class ClientAsyncWriter final : public ClientAsyncWriterInterface<W> {
}
}
::grpc_impl::ClientContext* context_;
::grpc::ClientContext* context_;
::grpc::internal::Call call_;
bool started_;
::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata>
@ -494,8 +492,8 @@ class ClientAsyncReaderWriterFactory {
/// used to send to the server when starting the call.
static ClientAsyncReaderWriter<W, R>* Create(
::grpc::ChannelInterface* channel, ::grpc::CompletionQueue* cq,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context, bool start, void* tag) {
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
bool start, void* tag) {
::grpc::internal::Call call = channel->CreateCall(method, context, cq);
return new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
@ -601,8 +599,7 @@ class ClientAsyncReaderWriter final
private:
friend class internal::ClientAsyncReaderWriterFactory<W, R>;
ClientAsyncReaderWriter(::grpc::internal::Call call,
::grpc_impl::ClientContext* context, bool start,
void* tag)
::grpc::ClientContext* context, bool start, void* tag)
: context_(context), call_(call), started_(start) {
if (start) {
StartCallInternal(tag);
@ -622,7 +619,7 @@ class ClientAsyncReaderWriter final
}
}
::grpc_impl::ClientContext* context_;
::grpc::ClientContext* context_;
::grpc::internal::Call call_;
bool started_;
::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata>

@ -21,7 +21,7 @@
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/client_context_impl.h>
#include <grpcpp/impl/codegen/client_context.h>
#include <grpcpp/impl/codegen/server_context.h>
#include <grpcpp/impl/codegen/service_type.h>
#include <grpcpp/impl/codegen/status.h>
@ -78,8 +78,8 @@ class ClientAsyncResponseReaderFactory {
template <class W>
static ClientAsyncResponseReader<R>* Create(
::grpc::ChannelInterface* channel, ::grpc::CompletionQueue* cq,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context, const W& request, bool start) {
const ::grpc::internal::RpcMethod& method, ::grpc::ClientContext* context,
const W& request, bool start) {
::grpc::internal::Call call = channel->CreateCall(method, context, cq);
return new (::grpc::g_core_codegen_interface->grpc_call_arena_alloc(
call.call(), sizeof(ClientAsyncResponseReader<R>)))
@ -153,15 +153,15 @@ class ClientAsyncResponseReader final
private:
friend class internal::ClientAsyncResponseReaderFactory<R>;
::grpc_impl::ClientContext* const context_;
::grpc::ClientContext* const context_;
::grpc::internal::Call call_;
bool started_;
bool initial_metadata_read_ = false;
template <class W>
ClientAsyncResponseReader(::grpc::internal::Call call,
::grpc_impl::ClientContext* context,
const W& request, bool start)
::grpc::ClientContext* context, const W& request,
bool start)
: context_(context), call_(call), started_(start) {
// Bind the metadata at time of StartCallInternal but set up the rest here
// TODO(ctiller): don't assert

@ -29,7 +29,7 @@
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/call_hook.h>
#include <grpcpp/impl/codegen/call_op_set_interface.h>
#include <grpcpp/impl/codegen/client_context_impl.h>
#include <grpcpp/impl/codegen/client_context.h>
#include <grpcpp/impl/codegen/completion_queue.h>
#include <grpcpp/impl/codegen/completion_queue_tag.h>
#include <grpcpp/impl/codegen/config.h>
@ -721,7 +721,7 @@ class CallOpRecvInitialMetadata {
public:
CallOpRecvInitialMetadata() : metadata_map_(nullptr) {}
void RecvInitialMetadata(::grpc_impl::ClientContext* context) {
void RecvInitialMetadata(::grpc::ClientContext* context) {
context->initial_metadata_received_ = true;
metadata_map_ = &context->recv_initial_metadata_;
}
@ -770,7 +770,7 @@ class CallOpClientRecvStatus {
CallOpClientRecvStatus()
: recv_status_(nullptr), debug_error_string_(nullptr) {}
void ClientRecvStatus(::grpc_impl::ClientContext* context, Status* status) {
void ClientRecvStatus(::grpc::ClientContext* context, Status* status) {
client_context_ = context;
metadata_map_ = &client_context_->trailing_metadata_;
recv_status_ = status;
@ -836,7 +836,7 @@ class CallOpClientRecvStatus {
private:
bool hijacked_ = false;
::grpc_impl::ClientContext* client_context_;
::grpc::ClientContext* client_context_;
MetadataMap* metadata_map_;
Status* recv_status_;
const char* debug_error_string_;

@ -25,7 +25,6 @@
#include <grpcpp/impl/codegen/time.h>
namespace grpc_impl {
class ClientContext;
template <class R>
class ClientReader;
template <class W>
@ -55,6 +54,7 @@ class ClientCallbackUnaryFactory;
namespace grpc {
class ChannelInterface;
class ClientContext;
class CompletionQueue;
namespace experimental {
@ -135,7 +135,7 @@ class ChannelInterface {
friend class ::grpc::experimental::DelegatingChannel;
friend class ::grpc::internal::InterceptedChannel;
virtual internal::Call CreateCall(const internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
::grpc::CompletionQueue* cq) = 0;
virtual void PerformOpsOnCall(internal::CallOpSetInterface* ops,
internal::Call* call) = 0;
@ -155,9 +155,8 @@ class ChannelInterface {
// method and adding a new pure method to an interface would be a breaking
// change (even though this is private and non-API)
virtual internal::Call CreateCallInternal(
const internal::RpcMethod& /*method*/,
::grpc_impl::ClientContext* /*context*/, ::grpc::CompletionQueue* /*cq*/,
size_t /*interceptor_pos*/) {
const internal::RpcMethod& /*method*/, ::grpc::ClientContext* /*context*/,
::grpc::CompletionQueue* /*cq*/, size_t /*interceptor_pos*/) {
return internal::Call();
}

@ -30,13 +30,13 @@
namespace grpc {
class Channel;
class ClientContext;
namespace internal {
class RpcMethod;
} // namespace internal
} // namespace grpc
namespace grpc_impl {
class ClientContext;
namespace internal {
@ -45,7 +45,7 @@ namespace internal {
template <class InputMessage, class OutputMessage>
void CallbackUnaryCall(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
const InputMessage* request, OutputMessage* result,
std::function<void(::grpc::Status)> on_completion) {
CallbackUnaryCallImpl<InputMessage, OutputMessage> x(
@ -57,7 +57,7 @@ class CallbackUnaryCallImpl {
public:
CallbackUnaryCallImpl(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
const InputMessage* request, OutputMessage* result,
std::function<void(::grpc::Status)> on_completion) {
::grpc::CompletionQueue* cq = channel->CallbackCQ();
@ -574,7 +574,7 @@ class ClientCallbackReaderWriterImpl
friend class ClientCallbackReaderWriterFactory<Request, Response>;
ClientCallbackReaderWriterImpl(grpc::internal::Call call,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
ClientBidiReactor<Request, Response>* reactor)
: context_(context),
call_(call),
@ -641,7 +641,7 @@ class ClientCallbackReaderWriterImpl
}
}
::grpc_impl::ClientContext* const context_;
::grpc::ClientContext* const context_;
grpc::internal::Call call_;
ClientBidiReactor<Request, Response>* const reactor_;
@ -690,7 +690,7 @@ class ClientCallbackReaderWriterFactory {
public:
static void Create(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
ClientBidiReactor<Request, Response>* reactor) {
grpc::internal::Call call =
channel->CreateCall(method, context, channel->CallbackCQ());
@ -785,8 +785,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
template <class Request>
ClientCallbackReaderImpl(::grpc::internal::Call call,
::grpc_impl::ClientContext* context,
Request* request,
::grpc::ClientContext* context, Request* request,
ClientReadReactor<Response>* reactor)
: context_(context), call_(call), reactor_(reactor) {
this->BindReactor(reactor);
@ -812,7 +811,7 @@ class ClientCallbackReaderImpl : public ClientCallbackReader<Response> {
}
}
::grpc_impl::ClientContext* const context_;
::grpc::ClientContext* const context_;
grpc::internal::Call call_;
ClientReadReactor<Response>* const reactor_;
@ -848,8 +847,7 @@ class ClientCallbackReaderFactory {
template <class Request>
static void Create(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
const Request* request,
::grpc::ClientContext* context, const Request* request,
ClientReadReactor<Response>* reactor) {
grpc::internal::Call call =
channel->CreateCall(method, context, channel->CallbackCQ());
@ -970,8 +968,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
template <class Response>
ClientCallbackWriterImpl(::grpc::internal::Call call,
::grpc_impl::ClientContext* context,
Response* response,
::grpc::ClientContext* context, Response* response,
ClientWriteReactor<Request>* reactor)
: context_(context),
call_(call),
@ -1027,7 +1024,7 @@ class ClientCallbackWriterImpl : public ClientCallbackWriter<Request> {
}
}
::grpc_impl::ClientContext* const context_;
::grpc::ClientContext* const context_;
grpc::internal::Call call_;
ClientWriteReactor<Request>* const reactor_;
@ -1074,7 +1071,7 @@ class ClientCallbackWriterFactory {
template <class Response>
static void Create(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context, Response* response,
::grpc::ClientContext* context, Response* response,
ClientWriteReactor<Request>* reactor) {
grpc::internal::Call call =
channel->CreateCall(method, context, channel->CallbackCQ());
@ -1130,7 +1127,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
template <class Request, class Response>
ClientCallbackUnaryImpl(::grpc::internal::Call call,
::grpc_impl::ClientContext* context, Request* request,
::grpc::ClientContext* context, Request* request,
Response* response, ClientUnaryReactor* reactor)
: context_(context), call_(call), reactor_(reactor) {
this->BindReactor(reactor);
@ -1156,7 +1153,7 @@ class ClientCallbackUnaryImpl final : public ClientCallbackUnary {
}
}
::grpc_impl::ClientContext* const context_;
::grpc::ClientContext* const context_;
grpc::internal::Call call_;
ClientUnaryReactor* const reactor_;
@ -1182,9 +1179,8 @@ class ClientCallbackUnaryFactory {
template <class Request, class Response>
static void Create(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
const Request* request, Response* response,
ClientUnaryReactor* reactor) {
::grpc::ClientContext* context, const Request* request,
Response* response, ClientUnaryReactor* reactor) {
grpc::internal::Call call =
channel->CreateCall(method, context, channel->CallbackCQ());

@ -1,6 +1,6 @@
/*
*
* Copyright 2019 gRPC authors.
* Copyright 2015 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,15 +16,512 @@
*
*/
/// A ClientContext allows the person implementing a service client to:
///
/// - Add custom metadata key-value pairs that will propagated to the server
/// side.
/// - Control call settings such as compression and authentication.
/// - Initial and trailing metadata coming from the server.
/// - Get performance metrics (ie, census).
///
/// Context settings are only relevant to the call they are invoked with, that
/// is to say, they aren't sticky. Some of these settings, such as the
/// compression options, can be made persistent at channel construction time
/// (see \a grpc::CreateCustomChannel).
///
/// \warning ClientContext instances should \em not be reused across rpcs.
#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H
#define GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_H
#include <grpcpp/impl/codegen/client_context_impl.h>
#include <map>
#include <memory>
#include <string>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/propagation_bits.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/create_auth_context.h>
#include <grpcpp/impl/codegen/metadata_map.h>
#include <grpcpp/impl/codegen/rpc_method.h>
#include <grpcpp/impl/codegen/security/auth_context.h>
#include <grpcpp/impl/codegen/slice.h>
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/impl/codegen/string_ref.h>
#include <grpcpp/impl/codegen/sync.h>
#include <grpcpp/impl/codegen/time.h>
struct census_context;
struct grpc_call;
namespace grpc_impl {
namespace internal {
template <class InputMessage, class OutputMessage>
class CallbackUnaryCallImpl;
template <class Request, class Response>
class ClientCallbackReaderWriterImpl;
template <class Response>
class ClientCallbackReaderImpl;
template <class Request>
class ClientCallbackWriterImpl;
class ClientCallbackUnaryImpl;
class ClientContextAccessor;
} // namespace internal
class ServerContext;
template <class R>
class ClientReader;
template <class W>
class ClientWriter;
template <class W, class R>
class ClientReaderWriter;
template <class R>
class ClientAsyncReader;
template <class W>
class ClientAsyncWriter;
template <class W, class R>
class ClientAsyncReaderWriter;
template <class R>
class ClientAsyncResponseReader;
class ServerContextBase;
class CallbackServerContext;
} // namespace grpc_impl
namespace grpc {
typedef ::grpc_impl::ClientContext ClientContext;
typedef ::grpc_impl::PropagationOptions PropagationOptions;
namespace testing {
class InteropClientContextInspector;
} // namespace testing
namespace internal {
class RpcMethod;
template <class InputMessage, class OutputMessage>
class BlockingUnaryCallImpl;
class CallOpClientRecvStatus;
class CallOpRecvInitialMetadata;
class ServerContextImpl;
template <class InputMessage, class OutputMessage>
class CallbackUnaryCallImpl;
template <class Request, class Response>
class ClientCallbackReaderWriterImpl;
template <class Response>
class ClientCallbackReaderImpl;
template <class Request>
class ClientCallbackWriterImpl;
class ClientCallbackUnaryImpl;
class ClientContextAccessor;
} // namespace internal
class CallCredentials;
class Channel;
class ChannelInterface;
class CompletionQueue;
/// Options for \a ClientContext::FromServerContext specifying which traits from
/// the \a ServerContext to propagate (copy) from it into a new \a
/// ClientContext.
///
/// \see ClientContext::FromServerContext
class PropagationOptions {
public:
PropagationOptions() : propagate_(GRPC_PROPAGATE_DEFAULTS) {}
PropagationOptions& enable_deadline_propagation() {
propagate_ |= GRPC_PROPAGATE_DEADLINE;
return *this;
}
PropagationOptions& disable_deadline_propagation() {
propagate_ &= ~GRPC_PROPAGATE_DEADLINE;
return *this;
}
PropagationOptions& enable_census_stats_propagation() {
propagate_ |= GRPC_PROPAGATE_CENSUS_STATS_CONTEXT;
return *this;
}
PropagationOptions& disable_census_stats_propagation() {
propagate_ &= ~GRPC_PROPAGATE_CENSUS_STATS_CONTEXT;
return *this;
}
PropagationOptions& enable_census_tracing_propagation() {
propagate_ |= GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT;
return *this;
}
PropagationOptions& disable_census_tracing_propagation() {
propagate_ &= ~GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT;
return *this;
}
PropagationOptions& enable_cancellation_propagation() {
propagate_ |= GRPC_PROPAGATE_CANCELLATION;
return *this;
}
PropagationOptions& disable_cancellation_propagation() {
propagate_ &= ~GRPC_PROPAGATE_CANCELLATION;
return *this;
}
uint32_t c_bitmask() const { return propagate_; }
private:
uint32_t propagate_;
};
/// A ClientContext allows the person implementing a service client to:
///
/// - Add custom metadata key-value pairs that will propagated to the server
/// side.
/// - Control call settings such as compression and authentication.
/// - Initial and trailing metadata coming from the server.
/// - Get performance metrics (ie, census).
///
/// Context settings are only relevant to the call they are invoked with, that
/// is to say, they aren't sticky. Some of these settings, such as the
/// compression options, can be made persistent at channel construction time
/// (see \a grpc::CreateCustomChannel).
///
/// \warning ClientContext instances should \em not be reused across rpcs.
/// \warning The ClientContext instance used for creating an rpc must remain
/// alive and valid for the lifetime of the rpc.
class ClientContext {
public:
ClientContext();
~ClientContext();
/// Create a new \a ClientContext as a child of an incoming server call,
/// according to \a options (\see PropagationOptions).
///
/// \param server_context The source server context to use as the basis for
/// constructing the client context.
/// \param options The options controlling what to copy from the \a
/// server_context.
///
/// \return A newly constructed \a ClientContext instance based on \a
/// server_context, with traits propagated (copied) according to \a options.
static std::unique_ptr<ClientContext> FromServerContext(
const grpc_impl::ServerContext& server_context,
PropagationOptions options = PropagationOptions());
static std::unique_ptr<ClientContext> FromCallbackServerContext(
const grpc_impl::CallbackServerContext& server_context,
PropagationOptions options = PropagationOptions());
/// Add the (\a meta_key, \a meta_value) pair to the metadata associated with
/// a client call. These are made available at the server side by the \a
/// grpc::ServerContext::client_metadata() method.
///
/// \warning This method should only be called before invoking the rpc.
///
/// \param meta_key The metadata key. If \a meta_value is binary data, it must
/// end in "-bin".
/// \param meta_value The metadata value. If its value is binary, the key name
/// must end in "-bin".
///
/// Metadata must conform to the following format:
/// Custom-Metadata -> Binary-Header / ASCII-Header
/// Binary-Header -> {Header-Name "-bin" } {binary value}
/// ASCII-Header -> Header-Name ASCII-Value
/// Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - .
/// ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII
void AddMetadata(const std::string& meta_key, const std::string& meta_value);
/// Return a collection of initial metadata key-value pairs. Note that keys
/// may happen more than once (ie, a \a std::multimap is returned).
///
/// \warning This method should only be called after initial metadata has been
/// received. For streaming calls, see \a
/// ClientReaderInterface::WaitForInitialMetadata().
///
/// \return A multimap of initial metadata key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerInitialMetadata() const {
GPR_CODEGEN_ASSERT(initial_metadata_received_);
return *recv_initial_metadata_.map();
}
/// Return a collection of trailing metadata key-value pairs. Note that keys
/// may happen more than once (ie, a \a std::multimap is returned).
///
/// \warning This method is only callable once the stream has finished.
///
/// \return A multimap of metadata trailing key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerTrailingMetadata() const {
// TODO(yangg) check finished
return *trailing_metadata_.map();
}
/// Set the deadline for the client call.
///
/// \warning This method should only be called before invoking the rpc.
///
/// \param deadline the deadline for the client call. Units are determined by
/// the type used. The deadline is an absolute (not relative) time.
template <typename T>
void set_deadline(const T& deadline) {
grpc::TimePoint<T> deadline_tp(deadline);
deadline_ = deadline_tp.raw_time();
}
/// EXPERIMENTAL: Indicate that this request is idempotent.
/// By default, RPCs are assumed to <i>not</i> be idempotent.
///
/// If true, the gRPC library assumes that it's safe to initiate
/// this RPC multiple times.
void set_idempotent(bool idempotent) { idempotent_ = idempotent; }
/// EXPERIMENTAL: Set this request to be cacheable.
/// If set, grpc is free to use the HTTP GET verb for sending the request,
/// with the possibility of receiving a cached response.
void set_cacheable(bool cacheable) { cacheable_ = cacheable; }
/// EXPERIMENTAL: Trigger wait-for-ready or not on this request.
/// See https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md.
/// If set, if an RPC is made when a channel's connectivity state is
/// TRANSIENT_FAILURE or CONNECTING, the call will not "fail fast",
/// and the channel will wait until the channel is READY before making the
/// call.
void set_wait_for_ready(bool wait_for_ready) {
wait_for_ready_ = wait_for_ready;
wait_for_ready_explicitly_set_ = true;
}
/// DEPRECATED: Use set_wait_for_ready() instead.
void set_fail_fast(bool fail_fast) { set_wait_for_ready(!fail_fast); }
/// Return the deadline for the client call.
std::chrono::system_clock::time_point deadline() const {
return grpc::Timespec2Timepoint(deadline_);
}
/// Return a \a gpr_timespec representation of the client call's deadline.
gpr_timespec raw_deadline() const { return deadline_; }
/// Set the per call authority header (see
/// https://tools.ietf.org/html/rfc7540#section-8.1.2.3).
void set_authority(const std::string& authority) { authority_ = authority; }
/// Return the authentication context for the associated client call.
/// It is only valid to call this during the lifetime of the client call.
///
/// \see grpc::AuthContext.
std::shared_ptr<const grpc::AuthContext> auth_context() const {
if (auth_context_.get() == nullptr) {
auth_context_ = grpc::CreateAuthContext(call_);
}
return auth_context_;
}
/// Set credentials for the client call.
///
/// A credentials object encapsulates all the state needed by a client to
/// authenticate with a server and make various assertions, e.g., about the
/// client’s identity, role, or whether it is authorized to make a particular
/// call.
///
/// It is legal to call this only before initial metadata is sent.
///
/// \see https://grpc.io/docs/guides/auth.html
void set_credentials(const std::shared_ptr<grpc::CallCredentials>& creds);
/// EXPERIMENTAL debugging API
///
/// Returns the credentials for the client call. This should be used only in
/// tests and for diagnostic purposes, and should not be used by application
/// logic.
std::shared_ptr<grpc::CallCredentials> credentials() { return creds_; }
/// Return the compression algorithm the client call will request be used.
/// Note that the gRPC runtime may decide to ignore this request, for example,
/// due to resource constraints.
grpc_compression_algorithm compression_algorithm() const {
return compression_algorithm_;
}
/// Set \a algorithm to be the compression algorithm used for the client call.
///
/// \param algorithm The compression algorithm used for the client call.
void set_compression_algorithm(grpc_compression_algorithm algorithm);
/// Flag whether the initial metadata should be \a corked
///
/// If \a corked is true, then the initial metadata will be coalesced with the
/// write of first message in the stream. As a result, any tag set for the
/// initial metadata operation (starting a client-streaming or bidi-streaming
/// RPC) will not actually be sent to the completion queue or delivered
/// via Next.
///
/// \param corked The flag indicating whether the initial metadata is to be
/// corked or not.
void set_initial_metadata_corked(bool corked) {
initial_metadata_corked_ = corked;
}
/// Return the peer uri in a string.
/// It is only valid to call this during the lifetime of the client call.
///
/// \warning This value is never authenticated or subject to any security
/// related code. It must not be used for any authentication related
/// functionality. Instead, use auth_context.
///
/// \return The call's peer URI.
std::string peer() const;
/// Sets the census context.
/// It is only valid to call this before the client call is created. A common
/// place of setting census context is from within the DefaultConstructor
/// method of GlobalCallbacks.
void set_census_context(struct census_context* ccp) { census_context_ = ccp; }
/// Returns the census context that has been set, or nullptr if not set.
struct census_context* census_context() const {
return census_context_;
}
/// Send a best-effort out-of-band cancel on the call associated with
/// this client context. The call could be in any stage; e.g., if it is
/// already finished, it may still return success.
///
/// There is no guarantee the call will be cancelled.
///
/// Note that TryCancel() does not change any of the tags that are pending
/// on the completion queue. All pending tags will still be delivered
/// (though their ok result may reflect the effect of cancellation).
void TryCancel();
/// Global Callbacks
///
/// Can be set exactly once per application to install hooks whenever
/// a client context is constructed and destructed.
class GlobalCallbacks {
public:
virtual ~GlobalCallbacks() {}
virtual void DefaultConstructor(ClientContext* context) = 0;
virtual void Destructor(ClientContext* context) = 0;
};
static void SetGlobalCallbacks(GlobalCallbacks* callbacks);
/// Should be used for framework-level extensions only.
/// Applications never need to call this method.
grpc_call* c_call() { return call_; }
/// EXPERIMENTAL debugging API
///
/// if status is not ok() for an RPC, this will return a detailed string
/// of the gRPC Core error that led to the failure. It should not be relied
/// upon for anything other than gaining more debug data in failure cases.
std::string debug_error_string() const { return debug_error_string_; }
private:
// Disallow copy and assign.
ClientContext(const ClientContext&);
ClientContext& operator=(const ClientContext&);
friend class ::grpc::testing::InteropClientContextInspector;
friend class ::grpc::internal::CallOpClientRecvStatus;
friend class ::grpc::internal::CallOpRecvInitialMetadata;
friend class ::grpc::Channel;
template <class R>
friend class ::grpc_impl::ClientReader;
template <class W>
friend class ::grpc_impl::ClientWriter;
template <class W, class R>
friend class ::grpc_impl::ClientReaderWriter;
template <class R>
friend class ::grpc_impl::ClientAsyncReader;
template <class W>
friend class ::grpc_impl::ClientAsyncWriter;
template <class W, class R>
friend class ::grpc_impl::ClientAsyncReaderWriter;
template <class R>
friend class ::grpc_impl::ClientAsyncResponseReader;
template <class InputMessage, class OutputMessage>
friend class ::grpc::internal::BlockingUnaryCallImpl;
template <class InputMessage, class OutputMessage>
friend class ::grpc_impl::internal::CallbackUnaryCallImpl;
template <class Request, class Response>
friend class ::grpc_impl::internal::ClientCallbackReaderWriterImpl;
template <class Response>
friend class ::grpc_impl::internal::ClientCallbackReaderImpl;
template <class Request>
friend class ::grpc_impl::internal::ClientCallbackWriterImpl;
friend class ::grpc_impl::internal::ClientCallbackUnaryImpl;
friend class ::grpc_impl::internal::ClientContextAccessor;
// Used by friend class CallOpClientRecvStatus
void set_debug_error_string(const std::string& debug_error_string) {
debug_error_string_ = debug_error_string;
}
grpc_call* call() const { return call_; }
void set_call(grpc_call* call,
const std::shared_ptr<::grpc::Channel>& channel);
grpc::experimental::ClientRpcInfo* set_client_rpc_info(
const char* method, grpc::internal::RpcMethod::RpcType type,
grpc::ChannelInterface* channel,
const std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>& creators,
size_t interceptor_pos) {
rpc_info_ = grpc::experimental::ClientRpcInfo(this, type, method, channel);
rpc_info_.RegisterInterceptors(creators, interceptor_pos);
return &rpc_info_;
}
uint32_t initial_metadata_flags() const {
return (idempotent_ ? GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST : 0) |
(wait_for_ready_ ? GRPC_INITIAL_METADATA_WAIT_FOR_READY : 0) |
(cacheable_ ? GRPC_INITIAL_METADATA_CACHEABLE_REQUEST : 0) |
(wait_for_ready_explicitly_set_
? GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET
: 0) |
(initial_metadata_corked_ ? GRPC_INITIAL_METADATA_CORKED : 0);
}
std::string authority() { return authority_; }
void SendCancelToInterceptors();
static std::unique_ptr<ClientContext> FromInternalServerContext(
const grpc_impl::ServerContextBase& server_context,
PropagationOptions options);
bool initial_metadata_received_;
bool wait_for_ready_;
bool wait_for_ready_explicitly_set_;
bool idempotent_;
bool cacheable_;
std::shared_ptr<::grpc::Channel> channel_;
grpc::internal::Mutex mu_;
grpc_call* call_;
bool call_canceled_;
gpr_timespec deadline_;
grpc::string authority_;
std::shared_ptr<grpc::CallCredentials> creds_;
mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
struct census_context* census_context_;
std::multimap<std::string, std::string> send_initial_metadata_;
mutable grpc::internal::MetadataMap recv_initial_metadata_;
mutable grpc::internal::MetadataMap trailing_metadata_;
grpc_call* propagate_from_call_;
PropagationOptions propagation_options_;
grpc_compression_algorithm compression_algorithm_;
bool initial_metadata_corked_;
std::string debug_error_string_;
grpc::experimental::ClientRpcInfo rpc_info_;
};
} // namespace grpc

@ -1,517 +0,0 @@
/*
*
* Copyright 2015 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.
*
*/
/// A ClientContext allows the person implementing a service client to:
///
/// - Add custom metadata key-value pairs that will propagated to the server
/// side.
/// - Control call settings such as compression and authentication.
/// - Initial and trailing metadata coming from the server.
/// - Get performance metrics (ie, census).
///
/// Context settings are only relevant to the call they are invoked with, that
/// is to say, they aren't sticky. Some of these settings, such as the
/// compression options, can be made persistent at channel construction time
/// (see \a grpc::CreateCustomChannel).
///
/// \warning ClientContext instances should \em not be reused across rpcs.
#ifndef GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_IMPL_H
#define GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_IMPL_H
#include <map>
#include <memory>
#include <string>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/propagation_bits.h>
#include <grpcpp/impl/codegen/client_interceptor.h>
#include <grpcpp/impl/codegen/config.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/create_auth_context.h>
#include <grpcpp/impl/codegen/metadata_map.h>
#include <grpcpp/impl/codegen/rpc_method.h>
#include <grpcpp/impl/codegen/security/auth_context.h>
#include <grpcpp/impl/codegen/slice.h>
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/impl/codegen/string_ref.h>
#include <grpcpp/impl/codegen/sync.h>
#include <grpcpp/impl/codegen/time.h>
struct census_context;
struct grpc_call;
namespace grpc {
class CallbackServerContext;
class CallCredentials;
class Channel;
class ChannelInterface;
class CompletionQueue;
class ServerContext;
class ServerContextBase;
namespace internal {
class RpcMethod;
template <class InputMessage, class OutputMessage>
class BlockingUnaryCallImpl;
class CallOpClientRecvStatus;
class CallOpRecvInitialMetadata;
class ServerContextImpl;
} // namespace internal
namespace testing {
class InteropClientContextInspector;
} // namespace testing
} // namespace grpc
namespace grpc_impl {
namespace internal {
template <class InputMessage, class OutputMessage>
class CallbackUnaryCallImpl;
template <class Request, class Response>
class ClientCallbackReaderWriterImpl;
template <class Response>
class ClientCallbackReaderImpl;
template <class Request>
class ClientCallbackWriterImpl;
class ClientCallbackUnaryImpl;
class ClientContextAccessor;
} // namespace internal
template <class R>
class ClientReader;
template <class W>
class ClientWriter;
template <class W, class R>
class ClientReaderWriter;
template <class R>
class ClientAsyncReader;
template <class W>
class ClientAsyncWriter;
template <class W, class R>
class ClientAsyncReaderWriter;
template <class R>
class ClientAsyncResponseReader;
/// Options for \a ClientContext::FromServerContext specifying which traits from
/// the \a ServerContext to propagate (copy) from it into a new \a
/// ClientContext.
///
/// \see ClientContext::FromServerContext
class PropagationOptions {
public:
PropagationOptions() : propagate_(GRPC_PROPAGATE_DEFAULTS) {}
PropagationOptions& enable_deadline_propagation() {
propagate_ |= GRPC_PROPAGATE_DEADLINE;
return *this;
}
PropagationOptions& disable_deadline_propagation() {
propagate_ &= ~GRPC_PROPAGATE_DEADLINE;
return *this;
}
PropagationOptions& enable_census_stats_propagation() {
propagate_ |= GRPC_PROPAGATE_CENSUS_STATS_CONTEXT;
return *this;
}
PropagationOptions& disable_census_stats_propagation() {
propagate_ &= ~GRPC_PROPAGATE_CENSUS_STATS_CONTEXT;
return *this;
}
PropagationOptions& enable_census_tracing_propagation() {
propagate_ |= GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT;
return *this;
}
PropagationOptions& disable_census_tracing_propagation() {
propagate_ &= ~GRPC_PROPAGATE_CENSUS_TRACING_CONTEXT;
return *this;
}
PropagationOptions& enable_cancellation_propagation() {
propagate_ |= GRPC_PROPAGATE_CANCELLATION;
return *this;
}
PropagationOptions& disable_cancellation_propagation() {
propagate_ &= ~GRPC_PROPAGATE_CANCELLATION;
return *this;
}
uint32_t c_bitmask() const { return propagate_; }
private:
uint32_t propagate_;
};
/// A ClientContext allows the person implementing a service client to:
///
/// - Add custom metadata key-value pairs that will propagated to the server
/// side.
/// - Control call settings such as compression and authentication.
/// - Initial and trailing metadata coming from the server.
/// - Get performance metrics (ie, census).
///
/// Context settings are only relevant to the call they are invoked with, that
/// is to say, they aren't sticky. Some of these settings, such as the
/// compression options, can be made persistent at channel construction time
/// (see \a grpc::CreateCustomChannel).
///
/// \warning ClientContext instances should \em not be reused across rpcs.
/// \warning The ClientContext instance used for creating an rpc must remain
/// alive and valid for the lifetime of the rpc.
class ClientContext {
public:
ClientContext();
~ClientContext();
/// Create a new \a ClientContext as a child of an incoming server call,
/// according to \a options (\see PropagationOptions).
///
/// \param server_context The source server context to use as the basis for
/// constructing the client context.
/// \param options The options controlling what to copy from the \a
/// server_context.
///
/// \return A newly constructed \a ClientContext instance based on \a
/// server_context, with traits propagated (copied) according to \a options.
static std::unique_ptr<ClientContext> FromServerContext(
const grpc::ServerContext& server_context,
PropagationOptions options = PropagationOptions());
static std::unique_ptr<ClientContext> FromCallbackServerContext(
const grpc::CallbackServerContext& server_context,
PropagationOptions options = PropagationOptions());
/// Add the (\a meta_key, \a meta_value) pair to the metadata associated with
/// a client call. These are made available at the server side by the \a
/// grpc::ServerContext::client_metadata() method.
///
/// \warning This method should only be called before invoking the rpc.
///
/// \param meta_key The metadata key. If \a meta_value is binary data, it must
/// end in "-bin".
/// \param meta_value The metadata value. If its value is binary, the key name
/// must end in "-bin".
///
/// Metadata must conform to the following format:
/// Custom-Metadata -> Binary-Header / ASCII-Header
/// Binary-Header -> {Header-Name "-bin" } {binary value}
/// ASCII-Header -> Header-Name ASCII-Value
/// Header-Name -> 1*( %x30-39 / %x61-7A / "_" / "-" / ".") ; 0-9 a-z _ - .
/// ASCII-Value -> 1*( %x20-%x7E ) ; space and printable ASCII
void AddMetadata(const std::string& meta_key, const std::string& meta_value);
/// Return a collection of initial metadata key-value pairs. Note that keys
/// may happen more than once (ie, a \a std::multimap is returned).
///
/// \warning This method should only be called after initial metadata has been
/// received. For streaming calls, see \a
/// ClientReaderInterface::WaitForInitialMetadata().
///
/// \return A multimap of initial metadata key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerInitialMetadata() const {
GPR_CODEGEN_ASSERT(initial_metadata_received_);
return *recv_initial_metadata_.map();
}
/// Return a collection of trailing metadata key-value pairs. Note that keys
/// may happen more than once (ie, a \a std::multimap is returned).
///
/// \warning This method is only callable once the stream has finished.
///
/// \return A multimap of metadata trailing key-value pairs from the server.
const std::multimap<grpc::string_ref, grpc::string_ref>&
GetServerTrailingMetadata() const {
// TODO(yangg) check finished
return *trailing_metadata_.map();
}
/// Set the deadline for the client call.
///
/// \warning This method should only be called before invoking the rpc.
///
/// \param deadline the deadline for the client call. Units are determined by
/// the type used. The deadline is an absolute (not relative) time.
template <typename T>
void set_deadline(const T& deadline) {
grpc::TimePoint<T> deadline_tp(deadline);
deadline_ = deadline_tp.raw_time();
}
/// EXPERIMENTAL: Indicate that this request is idempotent.
/// By default, RPCs are assumed to <i>not</i> be idempotent.
///
/// If true, the gRPC library assumes that it's safe to initiate
/// this RPC multiple times.
void set_idempotent(bool idempotent) { idempotent_ = idempotent; }
/// EXPERIMENTAL: Set this request to be cacheable.
/// If set, grpc is free to use the HTTP GET verb for sending the request,
/// with the possibility of receiving a cached response.
void set_cacheable(bool cacheable) { cacheable_ = cacheable; }
/// EXPERIMENTAL: Trigger wait-for-ready or not on this request.
/// See https://github.com/grpc/grpc/blob/master/doc/wait-for-ready.md.
/// If set, if an RPC is made when a channel's connectivity state is
/// TRANSIENT_FAILURE or CONNECTING, the call will not "fail fast",
/// and the channel will wait until the channel is READY before making the
/// call.
void set_wait_for_ready(bool wait_for_ready) {
wait_for_ready_ = wait_for_ready;
wait_for_ready_explicitly_set_ = true;
}
/// DEPRECATED: Use set_wait_for_ready() instead.
void set_fail_fast(bool fail_fast) { set_wait_for_ready(!fail_fast); }
/// Return the deadline for the client call.
std::chrono::system_clock::time_point deadline() const {
return grpc::Timespec2Timepoint(deadline_);
}
/// Return a \a gpr_timespec representation of the client call's deadline.
gpr_timespec raw_deadline() const { return deadline_; }
/// Set the per call authority header (see
/// https://tools.ietf.org/html/rfc7540#section-8.1.2.3).
void set_authority(const std::string& authority) { authority_ = authority; }
/// Return the authentication context for the associated client call.
/// It is only valid to call this during the lifetime of the client call.
///
/// \see grpc::AuthContext.
std::shared_ptr<const grpc::AuthContext> auth_context() const {
if (auth_context_.get() == nullptr) {
auth_context_ = grpc::CreateAuthContext(call_);
}
return auth_context_;
}
/// Set credentials for the client call.
///
/// A credentials object encapsulates all the state needed by a client to
/// authenticate with a server and make various assertions, e.g., about the
/// client’s identity, role, or whether it is authorized to make a particular
/// call.
///
/// It is legal to call this only before initial metadata is sent.
///
/// \see https://grpc.io/docs/guides/auth.html
void set_credentials(const std::shared_ptr<grpc::CallCredentials>& creds);
/// EXPERIMENTAL debugging API
///
/// Returns the credentials for the client call. This should be used only in
/// tests and for diagnostic purposes, and should not be used by application
/// logic.
std::shared_ptr<grpc::CallCredentials> credentials() { return creds_; }
/// Return the compression algorithm the client call will request be used.
/// Note that the gRPC runtime may decide to ignore this request, for example,
/// due to resource constraints.
grpc_compression_algorithm compression_algorithm() const {
return compression_algorithm_;
}
/// Set \a algorithm to be the compression algorithm used for the client call.
///
/// \param algorithm The compression algorithm used for the client call.
void set_compression_algorithm(grpc_compression_algorithm algorithm);
/// Flag whether the initial metadata should be \a corked
///
/// If \a corked is true, then the initial metadata will be coalesced with the
/// write of first message in the stream. As a result, any tag set for the
/// initial metadata operation (starting a client-streaming or bidi-streaming
/// RPC) will not actually be sent to the completion queue or delivered
/// via Next.
///
/// \param corked The flag indicating whether the initial metadata is to be
/// corked or not.
void set_initial_metadata_corked(bool corked) {
initial_metadata_corked_ = corked;
}
/// Return the peer uri in a string.
/// It is only valid to call this during the lifetime of the client call.
///
/// \warning This value is never authenticated or subject to any security
/// related code. It must not be used for any authentication related
/// functionality. Instead, use auth_context.
///
/// \return The call's peer URI.
std::string peer() const;
/// Sets the census context.
/// It is only valid to call this before the client call is created. A common
/// place of setting census context is from within the DefaultConstructor
/// method of GlobalCallbacks.
void set_census_context(struct census_context* ccp) { census_context_ = ccp; }
/// Returns the census context that has been set, or nullptr if not set.
struct census_context* census_context() const {
return census_context_;
}
/// Send a best-effort out-of-band cancel on the call associated with
/// this client context. The call could be in any stage; e.g., if it is
/// already finished, it may still return success.
///
/// There is no guarantee the call will be cancelled.
///
/// Note that TryCancel() does not change any of the tags that are pending
/// on the completion queue. All pending tags will still be delivered
/// (though their ok result may reflect the effect of cancellation).
void TryCancel();
/// Global Callbacks
///
/// Can be set exactly once per application to install hooks whenever
/// a client context is constructed and destructed.
class GlobalCallbacks {
public:
virtual ~GlobalCallbacks() {}
virtual void DefaultConstructor(ClientContext* context) = 0;
virtual void Destructor(ClientContext* context) = 0;
};
static void SetGlobalCallbacks(GlobalCallbacks* callbacks);
/// Should be used for framework-level extensions only.
/// Applications never need to call this method.
grpc_call* c_call() { return call_; }
/// EXPERIMENTAL debugging API
///
/// if status is not ok() for an RPC, this will return a detailed string
/// of the gRPC Core error that led to the failure. It should not be relied
/// upon for anything other than gaining more debug data in failure cases.
std::string debug_error_string() const { return debug_error_string_; }
private:
// Disallow copy and assign.
ClientContext(const ClientContext&);
ClientContext& operator=(const ClientContext&);
friend class ::grpc::testing::InteropClientContextInspector;
friend class ::grpc::internal::CallOpClientRecvStatus;
friend class ::grpc::internal::CallOpRecvInitialMetadata;
friend class ::grpc::Channel;
template <class R>
friend class ::grpc_impl::ClientReader;
template <class W>
friend class ::grpc_impl::ClientWriter;
template <class W, class R>
friend class ::grpc_impl::ClientReaderWriter;
template <class R>
friend class ::grpc_impl::ClientAsyncReader;
template <class W>
friend class ::grpc_impl::ClientAsyncWriter;
template <class W, class R>
friend class ::grpc_impl::ClientAsyncReaderWriter;
template <class R>
friend class ::grpc_impl::ClientAsyncResponseReader;
template <class InputMessage, class OutputMessage>
friend class ::grpc::internal::BlockingUnaryCallImpl;
template <class InputMessage, class OutputMessage>
friend class ::grpc_impl::internal::CallbackUnaryCallImpl;
template <class Request, class Response>
friend class ::grpc_impl::internal::ClientCallbackReaderWriterImpl;
template <class Response>
friend class ::grpc_impl::internal::ClientCallbackReaderImpl;
template <class Request>
friend class ::grpc_impl::internal::ClientCallbackWriterImpl;
friend class ::grpc_impl::internal::ClientCallbackUnaryImpl;
friend class ::grpc_impl::internal::ClientContextAccessor;
// Used by friend class CallOpClientRecvStatus
void set_debug_error_string(const std::string& debug_error_string) {
debug_error_string_ = debug_error_string;
}
grpc_call* call() const { return call_; }
void set_call(grpc_call* call,
const std::shared_ptr<::grpc::Channel>& channel);
grpc::experimental::ClientRpcInfo* set_client_rpc_info(
const char* method, grpc::internal::RpcMethod::RpcType type,
grpc::ChannelInterface* channel,
const std::vector<std::unique_ptr<
grpc::experimental::ClientInterceptorFactoryInterface>>& creators,
size_t interceptor_pos) {
rpc_info_ = grpc::experimental::ClientRpcInfo(this, type, method, channel);
rpc_info_.RegisterInterceptors(creators, interceptor_pos);
return &rpc_info_;
}
uint32_t initial_metadata_flags() const {
return (idempotent_ ? GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST : 0) |
(wait_for_ready_ ? GRPC_INITIAL_METADATA_WAIT_FOR_READY : 0) |
(cacheable_ ? GRPC_INITIAL_METADATA_CACHEABLE_REQUEST : 0) |
(wait_for_ready_explicitly_set_
? GRPC_INITIAL_METADATA_WAIT_FOR_READY_EXPLICITLY_SET
: 0) |
(initial_metadata_corked_ ? GRPC_INITIAL_METADATA_CORKED : 0);
}
std::string authority() { return authority_; }
void SendCancelToInterceptors();
static std::unique_ptr<ClientContext> FromInternalServerContext(
const grpc::ServerContextBase& server_context,
PropagationOptions options);
bool initial_metadata_received_;
bool wait_for_ready_;
bool wait_for_ready_explicitly_set_;
bool idempotent_;
bool cacheable_;
std::shared_ptr<::grpc::Channel> channel_;
grpc::internal::Mutex mu_;
grpc_call* call_;
bool call_canceled_;
gpr_timespec deadline_;
grpc::string authority_;
std::shared_ptr<grpc::CallCredentials> creds_;
mutable std::shared_ptr<const grpc::AuthContext> auth_context_;
struct census_context* census_context_;
std::multimap<std::string, std::string> send_initial_metadata_;
mutable grpc::internal::MetadataMap recv_initial_metadata_;
mutable grpc::internal::MetadataMap trailing_metadata_;
grpc_call* propagate_from_call_;
PropagationOptions propagation_options_;
grpc_compression_algorithm compression_algorithm_;
bool initial_metadata_corked_;
std::string debug_error_string_;
grpc::experimental::ClientRpcInfo rpc_info_;
};
} // namespace grpc_impl
#endif // GRPCPP_IMPL_CODEGEN_CLIENT_CONTEXT_IMPL_H

@ -26,14 +26,10 @@
#include <grpcpp/impl/codegen/rpc_method.h>
#include <grpcpp/impl/codegen/string_ref.h>
namespace grpc_impl {
class ClientContext;
} // namespace grpc_impl
namespace grpc {
class Channel;
class ClientContext;
namespace internal {
class InterceptorBatchMethodsImpl;
@ -96,7 +92,7 @@ class ClientRpcInfo {
/// Return a pointer to the underlying ClientContext structure associated
/// with the RPC to support features that apply to it
grpc_impl::ClientContext* client_context() { return ctx_; }
grpc::ClientContext* client_context() { return ctx_; }
/// Return the type of the RPC (unary or a streaming flavor)
Type type() const { return type_; }
@ -119,9 +115,8 @@ class ClientRpcInfo {
ClientRpcInfo() = default;
// Constructor will only be called from ClientContext
ClientRpcInfo(grpc_impl::ClientContext* ctx,
internal::RpcMethod::RpcType type, const char* method,
grpc::ChannelInterface* channel)
ClientRpcInfo(grpc::ClientContext* ctx, internal::RpcMethod::RpcType type,
const char* method, grpc::ChannelInterface* channel)
: ctx_(ctx),
type_(static_cast<Type>(type)),
method_(method),
@ -163,7 +158,7 @@ class ClientRpcInfo {
}
}
grpc_impl::ClientContext* ctx_ = nullptr;
grpc::ClientContext* ctx_ = nullptr;
// TODO(yashykt): make type_ const once move-assignment is deleted
Type type_{Type::UNKNOWN};
const char* method_ = nullptr;
@ -173,7 +168,7 @@ class ClientRpcInfo {
size_t hijacked_interceptor_ = 0;
friend class internal::InterceptorBatchMethodsImpl;
friend class grpc_impl::ClientContext;
friend class grpc::ClientContext;
};
// PLEASE DO NOT USE THIS. ALWAYS PREFER PER CHANNEL INTERCEPTORS OVER A GLOBAL

@ -25,18 +25,15 @@
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/status.h>
namespace grpc_impl {
class ClientContext;
} // namespace grpc_impl
namespace grpc {
class ClientContext;
namespace internal {
class RpcMethod;
/// Wrapper that performs a blocking unary call
template <class InputMessage, class OutputMessage>
Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method,
grpc_impl::ClientContext* context,
grpc::ClientContext* context,
const InputMessage& request, OutputMessage* result) {
return BlockingUnaryCallImpl<InputMessage, OutputMessage>(
channel, method, context, request, result)
@ -47,7 +44,7 @@ template <class InputMessage, class OutputMessage>
class BlockingUnaryCallImpl {
public:
BlockingUnaryCallImpl(ChannelInterface* channel, const RpcMethod& method,
grpc_impl::ClientContext* context,
grpc::ClientContext* context,
const InputMessage& request, OutputMessage* result) {
::grpc::CompletionQueue cq(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,

@ -46,7 +46,7 @@ class InterceptedChannel : public ChannelInterface {
InterceptedChannel(ChannelInterface* channel, size_t pos)
: channel_(channel), interceptor_pos_(pos) {}
Call CreateCall(const RpcMethod& method, ::grpc_impl::ClientContext* context,
Call CreateCall(const RpcMethod& method, ::grpc::ClientContext* context,
::grpc::CompletionQueue* cq) override {
return channel_->CreateCallInternal(method, context, cq, interceptor_pos_);
}

@ -20,7 +20,7 @@
#include <grpcpp/impl/codegen/call.h>
#include <grpcpp/impl/codegen/channel_interface.h>
#include <grpcpp/impl/codegen/client_context_impl.h>
#include <grpcpp/impl/codegen/client_context.h>
#include <grpcpp/impl/codegen/completion_queue.h>
#include <grpcpp/impl/codegen/core_codegen_interface.h>
#include <grpcpp/impl/codegen/server_context.h>
@ -162,7 +162,7 @@ class ClientReaderFactory {
template <class W>
static ClientReader<R>* Create(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
::grpc::ClientContext* context,
const W& request) {
return new ClientReader<R>(channel, method, context, request);
}
@ -231,7 +231,7 @@ class ClientReader final : public ClientReaderInterface<R> {
private:
friend class internal::ClientReaderFactory<R>;
::grpc_impl::ClientContext* context_;
::grpc::ClientContext* context_;
::grpc::CompletionQueue cq_;
::grpc::internal::Call call_;
@ -241,7 +241,7 @@ class ClientReader final : public ClientReaderInterface<R> {
template <class W>
ClientReader(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context, const W& request)
::grpc::ClientContext* context, const W& request)
: context_(context),
cq_(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,
@ -282,8 +282,7 @@ class ClientWriterFactory {
template <class R>
static ClientWriter<W>* Create(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context,
R* response) {
::grpc::ClientContext* context, R* response) {
return new ClientWriter<W>(channel, method, context, response);
}
};
@ -376,7 +375,7 @@ class ClientWriter : public ClientWriterInterface<W> {
template <class R>
ClientWriter(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context, R* response)
::grpc::ClientContext* context, R* response)
: context_(context),
cq_(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,
@ -395,7 +394,7 @@ class ClientWriter : public ClientWriterInterface<W> {
}
}
::grpc_impl::ClientContext* context_;
::grpc::ClientContext* context_;
::grpc::internal::CallOpSet<::grpc::internal::CallOpRecvInitialMetadata,
::grpc::internal::CallOpGenericRecvMessage,
::grpc::internal::CallOpClientRecvStatus>
@ -434,7 +433,7 @@ class ClientReaderWriterFactory {
static ClientReaderWriter<W, R>* Create(
::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context) {
::grpc::ClientContext* context) {
return new ClientReaderWriter<W, R>(channel, method, context);
}
};
@ -543,7 +542,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
private:
friend class internal::ClientReaderWriterFactory<W, R>;
::grpc_impl::ClientContext* context_;
::grpc::ClientContext* context_;
::grpc::CompletionQueue cq_;
::grpc::internal::Call call_;
@ -552,7 +551,7 @@ class ClientReaderWriter final : public ClientReaderWriterInterface<W, R> {
/// used to send to the server when starting the call.
ClientReaderWriter(::grpc::ChannelInterface* channel,
const ::grpc::internal::RpcMethod& method,
::grpc_impl::ClientContext* context)
::grpc::ClientContext* context)
: context_(context),
cq_(grpc_completion_queue_attributes{
GRPC_CQ_CURRENT_VERSION, GRPC_CQ_PLUCK, GRPC_CQ_DEFAULT_POLLING,

@ -22,6 +22,7 @@
#include <grpc/grpc_security_constants.h>
#include <grpcpp/security/auth_context.h>
#include <map>
#include <memory>
struct grpc_gcp_AltsContext;
@ -50,15 +51,16 @@ class AltsContext {
std::string local_service_account() const;
grpc_security_level security_level() const;
RpcProtocolVersions peer_rpc_versions() const;
const std::map<std::string, std::string>& peer_attributes() const;
private:
// TODO(ZhenLian): Also plumb field peer_attributes when it is in use
std::string application_protocol_;
std::string record_protocol_;
std::string peer_service_account_;
std::string local_service_account_;
grpc_security_level security_level_ = GRPC_SECURITY_NONE;
RpcProtocolVersions peer_rpc_versions_ = {{0, 0}, {0, 0}};
std::map<std::string, std::string> peer_attributes_map_;
};
} // namespace experimental

@ -141,8 +141,6 @@
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/lb_policy_registry.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/local_subchannel_pool.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/local_subchannel_pool.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/parse_address.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/parse_address.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/proxy_mapper.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/proxy_mapper_registry.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/proxy_mapper_registry.h" role="src" />
@ -638,6 +636,8 @@
<file baseinstalldir="/" name="src/core/lib/iomgr/lockfree_event.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/lockfree_event.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/nameser.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/parse_address.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/parse_address.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/poller/eventmanager_libuv.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/poller/eventmanager_libuv.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/iomgr/polling_entity.cc" role="src" />
@ -741,6 +741,12 @@
<file baseinstalldir="/" name="src/core/lib/profiling/basic_timers.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/profiling/stap_timers.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/profiling/timers.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/authorization_engine.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/authorization_engine.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/evaluate_args.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/evaluate_args.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/activation.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/authorization/mock_cel/cel_value.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/context/security_context.cc" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/context/security_context.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/security/credentials/alts/alts_credentials.cc" role="src" />
@ -968,6 +974,7 @@
<file baseinstalldir="/" name="src/php/ext/grpc/timeval.h" role="src" />
<file baseinstalldir="/" name="src/php/ext/grpc/version.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/algorithm/algorithm.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/algorithm/container.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/attributes.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/call_once.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/casts.h" role="src" />
@ -982,6 +989,8 @@
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/internal/direct_mmap.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/internal/endian.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/internal/errno_saver.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/internal/exponential_biased.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/internal/exponential_biased.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/internal/hide_ptr.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/internal/identity.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/internal/inline_variable.h" role="src" />
@ -1021,9 +1030,22 @@
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/port.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/base/thread_annotations.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/fixed_array.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/flat_hash_set.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/inlined_vector.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/common.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/compressed_tuple.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/container_memory.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/hash_function_defaults.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/hash_policy_traits.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/hashtable_debug_hooks.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_force_weak_definition.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/have_sse.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/inlined_vector.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/layout.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/raw_hash_set.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/container/internal/raw_hash_set.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/debugging/internal/address_is_readable.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/debugging/internal/address_is_readable.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/debugging/internal/demangle.cc" role="src" />
@ -1050,6 +1072,11 @@
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/debugging/symbolize_win32.inc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/functional/function_ref.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/functional/internal/function_ref.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/hash/hash.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/hash/internal/city.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/hash/internal/city.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/hash/internal/hash.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/hash/internal/hash.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/memory/memory.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/meta/type_traits.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/numeric/int128.cc" role="src" />
@ -1167,10 +1194,14 @@
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/time/time.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/bad_optional_access.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/bad_optional_access.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/bad_variant_access.cc" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/bad_variant_access.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/internal/optional.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/internal/span.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/internal/variant.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/optional.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/span.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/types/variant.h" role="src" />
<file baseinstalldir="/" name="third_party/abseil-cpp/absl/utility/utility.h" role="src" />
<file baseinstalldir="/" name="third_party/address_sorting/address_sorting.c" role="src" />
<file baseinstalldir="/" name="third_party/address_sorting/address_sorting_internal.h" role="src" />
@ -1390,6 +1421,8 @@
<file baseinstalldir="/" name="third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/internal.h" role="src" />
<file baseinstalldir="/" name="third_party/boringssl-with-bazel/src/crypto/fipsmodule/tls/kdf.c" role="src" />
<file baseinstalldir="/" name="third_party/boringssl-with-bazel/src/crypto/hkdf/hkdf.c" role="src" />
<file baseinstalldir="/" name="third_party/boringssl-with-bazel/src/crypto/hpke/hpke.c" role="src" />
<file baseinstalldir="/" name="third_party/boringssl-with-bazel/src/crypto/hpke/internal.h" role="src" />
<file baseinstalldir="/" name="third_party/boringssl-with-bazel/src/crypto/hrss/hrss.c" role="src" />
<file baseinstalldir="/" name="third_party/boringssl-with-bazel/src/crypto/hrss/internal.h" role="src" />
<file baseinstalldir="/" name="third_party/boringssl-with-bazel/src/crypto/internal.h" role="src" />

@ -1,4 +1,4 @@
// generated by generate_boringssl_prefix_header.sh on BoringSSL commit: e8a935e323510419e0b37638716f6df4dcbbe6f6
// generated by generate_boringssl_prefix_header.sh on BoringSSL commit: 412844d75b14b9090b58423fd5f5ed8c2fd80212
// Copyright (c) 2018, Google Inc.
//
@ -303,6 +303,7 @@
#define SSL_get0_ocsp_response BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get0_ocsp_response)
#define SSL_get0_param BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get0_param)
#define SSL_get0_peer_certificates BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get0_peer_certificates)
#define SSL_get0_peer_delegation_algorithms BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get0_peer_delegation_algorithms)
#define SSL_get0_peer_verify_algorithms BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get0_peer_verify_algorithms)
#define SSL_get0_server_requested_CAs BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get0_server_requested_CAs)
#define SSL_get0_session_id_context BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, SSL_get0_session_id_context)
@ -1491,6 +1492,15 @@
#define EVP_EncryptInit BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_EncryptInit)
#define EVP_EncryptInit_ex BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_EncryptInit_ex)
#define EVP_EncryptUpdate BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_EncryptUpdate)
#define EVP_HPKE_CTX_cleanup BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_cleanup)
#define EVP_HPKE_CTX_export BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_export)
#define EVP_HPKE_CTX_init BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_init)
#define EVP_HPKE_CTX_max_overhead BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_max_overhead)
#define EVP_HPKE_CTX_open BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_open)
#define EVP_HPKE_CTX_seal BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_seal)
#define EVP_HPKE_CTX_setup_base_r_x25519 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_setup_base_r_x25519)
#define EVP_HPKE_CTX_setup_base_s_x25519 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_setup_base_s_x25519)
#define EVP_HPKE_CTX_setup_base_s_x25519_for_test BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_HPKE_CTX_setup_base_s_x25519_for_test)
#define EVP_MD_CTX_block_size BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_MD_CTX_block_size)
#define EVP_MD_CTX_cleanup BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_MD_CTX_cleanup)
#define EVP_MD_CTX_copy BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, EVP_MD_CTX_copy)
@ -2403,6 +2413,8 @@
#define X509_REVOKED_set_revocationDate BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_REVOKED_set_revocationDate)
#define X509_REVOKED_set_serialNumber BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_REVOKED_set_serialNumber)
#define X509_SIG_free BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_SIG_free)
#define X509_SIG_get0 BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_SIG_get0)
#define X509_SIG_getm BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_SIG_getm)
#define X509_SIG_it BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_SIG_it)
#define X509_SIG_new BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_SIG_new)
#define X509_STORE_CTX_cleanup BORINGSSL_ADD_PREFIX(BORINGSSL_PREFIX, X509_STORE_CTX_cleanup)

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"]) # Apache v2
licenses(["notice"])
exports_files(["LICENSE"])

@ -124,7 +124,7 @@ inline std::string RubyTypeOf(const grpc::protobuf::Descriptor* descriptor) {
ReplacePrefix(&proto_type, ".", ""); // remove the leading . (no package)
proto_type = RubyPackage(descriptor->file()) + "." + proto_type;
}
std::string res(proto_type);
std::string res("." + proto_type);
if (res.find('.') == std::string::npos) {
return res;
} else {

@ -106,6 +106,7 @@ static void g_poller_unref() {
grpc_schedule_on_exec_ctx));
gpr_mu_unlock(p->pollset_mu);
grpc_timer_cancel(&p->polling_timer);
backup_poller_shutdown_unref(p);
} else {
gpr_mu_unlock(&g_poller_mu);
}
@ -143,8 +144,8 @@ static void g_poller_init_locked() {
g_poller->shutting_down = false;
grpc_pollset_init(g_poller->pollset, &g_poller->pollset_mu);
gpr_ref_init(&g_poller->refs, 0);
// one for timer cancellation, one for pollset shutdown
gpr_ref_init(&g_poller->shutdown_refs, 2);
// one for timer cancellation, one for pollset shutdown, one for g_poller
gpr_ref_init(&g_poller->shutdown_refs, 3);
GRPC_CLOSURE_INIT(&g_poller->run_poller_closure, run_poller, g_poller,
grpc_schedule_on_exec_ctx);
grpc_timer_init(&g_poller->polling_timer,

@ -28,6 +28,7 @@
#include <set>
#include "absl/strings/numbers.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
@ -331,6 +332,7 @@ class ChannelData {
// applied in the data plane mutex when the picker is updated.
std::map<RefCountedPtr<SubchannelWrapper>, RefCountedPtr<ConnectedSubchannel>>
pending_subchannel_updates_;
int keepalive_time_ = -1;
//
// Fields accessed from both data plane mutex and control plane
@ -972,6 +974,10 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
void ResetBackoff() override { subchannel_->ResetBackoff(); }
void ThrottleKeepaliveTime(int new_keepalive_time) {
subchannel_->ThrottleKeepaliveTime(new_keepalive_time);
}
const grpc_channel_args* channel_args() override {
return subchannel_->channel_args();
}
@ -1102,6 +1108,32 @@ class ChannelData::SubchannelWrapper : public SubchannelInterface {
watcher_.get());
}
ConnectivityStateChange state_change = PopConnectivityStateChange();
absl::optional<absl::Cord> keepalive_throttling =
state_change.status.GetPayload(grpc_core::kKeepaliveThrottlingKey);
if (keepalive_throttling.has_value()) {
int new_keepalive_time = -1;
if (absl::SimpleAtoi(std::string(keepalive_throttling.value()),
&new_keepalive_time)) {
if (new_keepalive_time > parent_->chand_->keepalive_time_) {
parent_->chand_->keepalive_time_ = new_keepalive_time;
if (GRPC_TRACE_FLAG_ENABLED(grpc_client_channel_routing_trace)) {
gpr_log(GPR_INFO, "chand=%p: throttling keepalive time to %d",
parent_->chand_, parent_->chand_->keepalive_time_);
}
// Propagate the new keepalive time to all subchannels. This is so
// that new transports created by any subchannel (and not just the
// subchannel that received the GOAWAY), use the new keepalive time.
for (auto* subchannel_wrapper :
parent_->chand_->subchannel_wrappers_) {
subchannel_wrapper->ThrottleKeepaliveTime(new_keepalive_time);
}
}
} else {
gpr_log(GPR_ERROR, "chand=%p: Illegal keepalive throttling value %s",
parent_->chand_,
std::string(keepalive_throttling.value()).c_str());
}
}
// Ignore update if the parent WatcherWrapper has been replaced
// since this callback was scheduled.
if (watcher_ != nullptr) {
@ -1350,6 +1382,7 @@ class ChannelData::ClientChannelControlHelper
chand_->client_channel_factory_->CreateSubchannel(new_args);
grpc_channel_args_destroy(new_args);
if (subchannel == nullptr) return nullptr;
subchannel->ThrottleKeepaliveTime(chand_->keepalive_time_);
return MakeRefCounted<SubchannelWrapper>(
chand_, subchannel, std::move(health_check_service_name));
}
@ -1683,6 +1716,9 @@ ChannelData::ChannelData(grpc_channel_element_args* args, grpc_error** error)
channel_args_ = new_args != nullptr
? new_args
: grpc_channel_args_copy(args->channel_args);
keepalive_time_ = grpc_channel_args_find_integer(
channel_args_, GRPC_ARG_KEEPALIVE_TIME_MS,
{-1 /* default value, unset */, 1, INT_MAX});
if (!ResolverRegistry::IsValidTarget(target_uri_.get())) {
std::string error_message =
absl::StrCat("the target uri is not valid: ", target_uri_.get());
@ -2140,13 +2176,14 @@ void CallData::Destroy(grpc_call_element* elem,
const grpc_call_final_info* /*final_info*/,
grpc_closure* then_schedule_closure) {
CallData* calld = static_cast<CallData*>(elem->call_data);
if (GPR_LIKELY(calld->subchannel_call_ != nullptr)) {
calld->subchannel_call_->SetAfterCallStackDestroy(then_schedule_closure);
then_schedule_closure = nullptr;
}
RefCountedPtr<SubchannelCall> subchannel_call = calld->subchannel_call_;
calld->~CallData();
// TODO(yashkt) : This can potentially be a Closure::Run
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
if (GPR_LIKELY(subchannel_call != nullptr)) {
subchannel_call->SetAfterCallStackDestroy(then_schedule_closure);
} else {
// TODO(yashkt) : This can potentially be a Closure::Run
ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure, GRPC_ERROR_NONE);
}
}
void CallData::StartTransportStreamOpBatch(

@ -91,11 +91,12 @@ void HealthCheckClient::SetHealthStatusLocked(grpc_connectivity_state state,
gpr_log(GPR_INFO, "HealthCheckClient %p: setting state=%s reason=%s", this,
ConnectivityStateName(state), reason);
}
if (watcher_ != nullptr)
if (watcher_ != nullptr) {
watcher_->Notify(state,
state == GRPC_CHANNEL_TRANSIENT_FAILURE
? absl::Status(absl::StatusCode::kUnavailable, reason)
: absl::Status());
}
}
void HealthCheckClient::Orphan() {

@ -87,7 +87,6 @@
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h"
#include "src/core/ext/filters/client_channel/lb_policy_factory.h"
#include "src/core/ext/filters/client_channel/lb_policy_registry.h"
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/backoff/backoff.h"
@ -98,6 +97,7 @@
#include "src/core/lib/gprpp/memory.h"
#include "src/core/lib/gprpp/orphanable.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/timer.h"

@ -37,7 +37,6 @@
#include <grpc/support/time.h>
#include <address_sorting/address_sorting.h>
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gprpp/host_port.h"
@ -45,6 +44,7 @@
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr_internal.h"
#include "src/core/lib/iomgr/nameser.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/transport/authority_override.h"

@ -23,10 +23,10 @@
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/parse_address.h"
bool grpc_ares_query_ipv6() {
/* The libuv grpc code currently does not have the code to probe for this,

@ -23,10 +23,10 @@
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/socket_windows.h"
bool grpc_ares_query_ipv6() { return grpc_ipv6_loopback_available(); }

@ -28,13 +28,13 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/gpr/useful.h"
#include "src/core/lib/iomgr/closure.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "src/core/lib/iomgr/work_serializer.h"

@ -26,11 +26,11 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/resolver_registry.h"
#include "src/core/ext/filters/client_channel/server_address.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/gpr/string.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "src/core/lib/iomgr/work_serializer.h"

@ -33,7 +33,6 @@
#include "src/core/ext/filters/client_channel/client_channel.h"
#include "src/core/ext/filters/client_channel/health/health_check_client.h"
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/client_channel/proxy_mapper_registry.h"
#include "src/core/ext/filters/client_channel/service_config.h"
#include "src/core/ext/filters/client_channel/subchannel_pool_interface.h"
@ -46,6 +45,7 @@
#include "src/core/lib/gprpp/manual_constructor.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/gprpp/sync.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/slice/slice_internal.h"
@ -743,6 +743,25 @@ Subchannel* Subchannel::Create(OrphanablePtr<SubchannelConnector> connector,
return registered;
}
void Subchannel::ThrottleKeepaliveTime(int new_keepalive_time) {
MutexLock lock(&mu_);
// Only update the value if the new keepalive time is larger.
if (new_keepalive_time > keepalive_time_) {
keepalive_time_ = new_keepalive_time;
if (grpc_trace_subchannel.enabled()) {
gpr_log(GPR_INFO, "Subchannel=%p: Throttling keepalive time to %d", this,
new_keepalive_time);
}
const grpc_arg arg_to_add = grpc_channel_arg_integer_create(
const_cast<char*>(GRPC_ARG_KEEPALIVE_TIME_MS), new_keepalive_time);
const char* arg_to_remove = GRPC_ARG_KEEPALIVE_TIME_MS;
grpc_channel_args* new_args = grpc_channel_args_copy_and_add_and_remove(
args_, &arg_to_remove, 1, &arg_to_add, 1);
grpc_channel_args_destroy(args_);
args_ = new_args;
}
}
Subchannel* Subchannel::Ref(GRPC_SUBCHANNEL_REF_EXTRA_ARGS) {
gpr_atm old_refs;
old_refs = RefMutate((1 << INTERNAL_REF_BITS),

@ -228,6 +228,11 @@ class Subchannel {
static Subchannel* Create(OrphanablePtr<SubchannelConnector> connector,
const grpc_channel_args* args);
// Throttles keepalive time to \a new_keepalive_time iff \a new_keepalive_time
// is larger than the subchannel's current keepalive time. The updated value
// will have an affect when the subchannel creates a new ConnectedSubchannel.
void ThrottleKeepaliveTime(int new_keepalive_time);
// Strong and weak refcounting.
Subchannel* Ref(GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
void Unref(GRPC_SUBCHANNEL_REF_EXTRA_ARGS);
@ -422,6 +427,8 @@ class Subchannel {
bool have_retry_alarm_ = false;
// reset_backoff() was called while alarm was pending.
bool retry_immediately_ = false;
// Keepalive time period (-1 for unset)
int keepalive_time_ = -1;
// Channelz tracking.
RefCountedPtr<channelz::SubchannelNode> channelz_node_;

@ -30,11 +30,11 @@
#include <grpc/support/log.h>
#include "src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h"
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/ext/filters/load_reporting/registered_opencensus_objects.h"
#include "src/core/ext/filters/load_reporting/server_load_reporting_filter.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/context.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"

@ -199,6 +199,8 @@ void Chttp2Connector::OnReceiveSettings(void* arg, grpc_error* error) {
{
MutexLock lock(&self->mu_);
if (!self->notify_error_.has_value()) {
grpc_endpoint_delete_from_pollset_set(self->endpoint_,
self->args_.interested_parties);
if (error != GRPC_ERROR_NONE) {
// Transport got an error while waiting on SETTINGS frame.
// TODO(yashykt): The following two lines should be moved to
@ -225,6 +227,8 @@ void Chttp2Connector::OnTimeout(void* arg, grpc_error* error) {
if (!self->notify_error_.has_value()) {
// The transport did not receive the settings frame in time. Destroy the
// transport.
grpc_endpoint_delete_from_pollset_set(self->endpoint_,
self->args_.interested_parties);
// TODO(yashykt): The following two lines should be moved to
// SubchannelConnector::Result::Reset()
grpc_transport_destroy(self->result_->transport);
@ -245,11 +249,8 @@ void Chttp2Connector::MaybeNotify(grpc_error* error) {
if (notify_error_.has_value()) {
GRPC_ERROR_UNREF(error);
NullThenSchedClosure(DEBUG_LOCATION, &notify_, notify_error_.value());
// Clear out the endpoint, since it is the responsibility of the transport
// to shut it down.
// Clear state for a new Connect().
grpc_endpoint_delete_from_pollset_set(endpoint_, args_.interested_parties);
// We do not destroy the endpoint here, since it is the responsibility of
// Clear out the endpoint_, since it is the responsibility of
// the transport to shut it down.
endpoint_ = nullptr;
notify_error_.reset();

@ -1084,6 +1084,7 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string.c_str(),
goaway_error, grpc_error_string(t->goaway_error));
}
absl::Status status = grpc_error_to_absl_status(t->goaway_error);
// When a client receives a GOAWAY with error code ENHANCE_YOUR_CALM and debug
// data equal to "too_many_pings", it should log the occurrence at a log level
// that is enabled by default and double the configured KEEPALIVE_TIME used
@ -1102,8 +1103,9 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
? GRPC_MILLIS_INF_FUTURE
: static_cast<grpc_millis>(current_keepalive_time_ms *
KEEPALIVE_TIME_BACKOFF_MULTIPLIER);
status.SetPayload(grpc_core::kKeepaliveThrottlingKey,
absl::Cord(std::to_string(t->keepalive_time)));
}
absl::Status status = grpc_error_to_absl_status(t->goaway_error);
// lie: use transient failure from the transport to indicate goaway has been
// received.
connectivity_state_set(t, GRPC_CHANNEL_TRANSIENT_FAILURE, status,
@ -1410,64 +1412,44 @@ static void perform_stream_op_locked(void* stream_op,
s->send_initial_metadata_finished = add_closure_barrier(on_complete);
s->send_initial_metadata =
op_payload->send_initial_metadata.send_initial_metadata;
const size_t metadata_size =
grpc_metadata_batch_size(s->send_initial_metadata);
const size_t metadata_peer_limit =
t->settings[GRPC_PEER_SETTINGS]
[GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE];
if (t->is_client) {
s->deadline = GPR_MIN(s->deadline, s->send_initial_metadata->deadline);
}
if (metadata_size > metadata_peer_limit) {
grpc_chttp2_cancel_stream(
t, s,
grpc_error_set_int(
grpc_error_set_int(
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"to-be-sent initial metadata size "
"exceeds peer limit"),
GRPC_ERROR_INT_SIZE,
static_cast<intptr_t>(metadata_size)),
GRPC_ERROR_INT_LIMIT,
static_cast<intptr_t>(metadata_peer_limit)),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
} else {
if (contains_non_ok_status(s->send_initial_metadata)) {
s->seen_error = true;
}
if (!s->write_closed) {
if (t->is_client) {
if (t->closed_with_error == GRPC_ERROR_NONE) {
GPR_ASSERT(s->id == 0);
grpc_chttp2_list_add_waiting_for_concurrency(t, s);
maybe_start_some_streams(t);
} else {
grpc_chttp2_cancel_stream(
t, s,
grpc_error_set_int(
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Transport closed", &t->closed_with_error, 1),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
}
if (contains_non_ok_status(s->send_initial_metadata)) {
s->seen_error = true;
}
if (!s->write_closed) {
if (t->is_client) {
if (t->closed_with_error == GRPC_ERROR_NONE) {
GPR_ASSERT(s->id == 0);
grpc_chttp2_list_add_waiting_for_concurrency(t, s);
maybe_start_some_streams(t);
} else {
GPR_ASSERT(s->id != 0);
grpc_chttp2_mark_stream_writable(t, s);
if (!(op->send_message &&
(op->payload->send_message.send_message->flags() &
GRPC_WRITE_BUFFER_HINT))) {
grpc_chttp2_initiate_write(
t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
}
grpc_chttp2_cancel_stream(
t, s,
grpc_error_set_int(
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Transport closed", &t->closed_with_error, 1),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
}
} else {
s->send_initial_metadata = nullptr;
grpc_chttp2_complete_closure_step(
t, s, &s->send_initial_metadata_finished,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Attempt to send initial metadata after stream was closed",
&s->write_closed_error, 1),
"send_initial_metadata_finished");
GPR_ASSERT(s->id != 0);
grpc_chttp2_mark_stream_writable(t, s);
if (!(op->send_message &&
(op->payload->send_message.send_message->flags() &
GRPC_WRITE_BUFFER_HINT))) {
grpc_chttp2_initiate_write(
t, GRPC_CHTTP2_INITIATE_WRITE_SEND_INITIAL_METADATA);
}
}
} else {
s->send_initial_metadata = nullptr;
grpc_chttp2_complete_closure_step(
t, s, &s->send_initial_metadata_finished,
GRPC_ERROR_CREATE_REFERENCING_FROM_STATIC_STRING(
"Attempt to send initial metadata after stream was closed",
&s->write_closed_error, 1),
"send_initial_metadata_finished");
}
if (op_payload->send_initial_metadata.peer_string != nullptr) {
gpr_atm_rel_store(op_payload->send_initial_metadata.peer_string,
@ -1529,47 +1511,27 @@ static void perform_stream_op_locked(void* stream_op,
op_payload->send_trailing_metadata.send_trailing_metadata;
s->sent_trailing_metadata_op = op_payload->send_trailing_metadata.sent;
s->write_buffering = false;
const size_t metadata_size =
grpc_metadata_batch_size(s->send_trailing_metadata);
const size_t metadata_peer_limit =
t->settings[GRPC_PEER_SETTINGS]
[GRPC_CHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE];
if (metadata_size > metadata_peer_limit) {
grpc_chttp2_cancel_stream(
t, s,
grpc_error_set_int(
grpc_error_set_int(
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"to-be-sent trailing metadata size "
"exceeds peer limit"),
GRPC_ERROR_INT_SIZE,
static_cast<intptr_t>(metadata_size)),
GRPC_ERROR_INT_LIMIT,
static_cast<intptr_t>(metadata_peer_limit)),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_RESOURCE_EXHAUSTED));
} else {
if (contains_non_ok_status(s->send_trailing_metadata)) {
s->seen_error = true;
}
if (s->write_closed) {
s->send_trailing_metadata = nullptr;
s->sent_trailing_metadata_op = nullptr;
grpc_chttp2_complete_closure_step(
t, s, &s->send_trailing_metadata_finished,
grpc_metadata_batch_is_empty(
op->payload->send_trailing_metadata.send_trailing_metadata)
? GRPC_ERROR_NONE
: GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Attempt to send trailing metadata after "
"stream was closed"),
"send_trailing_metadata_finished");
} else if (s->id != 0) {
// TODO(ctiller): check if there's flow control for any outstanding
// bytes before going writable
grpc_chttp2_mark_stream_writable(t, s);
grpc_chttp2_initiate_write(
t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA);
}
if (contains_non_ok_status(s->send_trailing_metadata)) {
s->seen_error = true;
}
if (s->write_closed) {
s->send_trailing_metadata = nullptr;
s->sent_trailing_metadata_op = nullptr;
grpc_chttp2_complete_closure_step(
t, s, &s->send_trailing_metadata_finished,
grpc_metadata_batch_is_empty(
op->payload->send_trailing_metadata.send_trailing_metadata)
? GRPC_ERROR_NONE
: GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"Attempt to send trailing metadata after "
"stream was closed"),
"send_trailing_metadata_finished");
} else if (s->id != 0) {
// TODO(ctiller): check if there's flow control for any outstanding
// bytes before going writable
grpc_chttp2_mark_stream_writable(t, s);
grpc_chttp2_initiate_write(
t, GRPC_CHTTP2_INITIATE_WRITE_SEND_TRAILING_METADATA);
}
}

@ -391,27 +391,6 @@ static bool md_key_cmp(grpc_mdelem md, const grpc_slice& reference) {
return GRPC_MDKEY(md).refcount == reference.refcount;
}
static bool md_cmp(grpc_mdelem md, grpc_mdelem ref_md,
const grpc_slice& ref_key) {
if (GPR_LIKELY(GRPC_MDELEM_IS_INTERNED(md))) {
return md.payload == ref_md.payload;
}
if (md_key_cmp(md, ref_key)) {
return grpc_slice_eq_static_interned(GRPC_MDVALUE(md),
GRPC_MDVALUE(ref_md));
}
return false;
}
static bool is_nonzero_status(grpc_mdelem md) {
// If md.payload == GRPC_MDELEM_GRPC_STATUS_1 or GRPC_MDELEM_GRPC_STATUS_2,
// then we have seen an error. In fact, if it is a GRPC_STATUS and it's
// not equal to GRPC_MDELEM_GRPC_STATUS_0, then we have seen an error.
// TODO(ctiller): check for a status like " 0"
return md_key_cmp(md, GRPC_MDSTR_GRPC_STATUS) &&
!md_cmp(md, GRPC_MDELEM_GRPC_STATUS_0, GRPC_MDSTR_GRPC_STATUS);
}
static void GPR_ATTRIBUTE_NOINLINE on_initial_header_log(
grpc_chttp2_transport* t, grpc_chttp2_stream* s, grpc_mdelem md) {
char* key = grpc_slice_to_c_string(GRPC_MDKEY(md));
@ -493,9 +472,7 @@ static grpc_error* on_initial_header(void* tp, grpc_mdelem md) {
on_initial_header_log(t, s, md);
}
if (is_nonzero_status(md)) { // not GRPC_MDELEM_GRPC_STATUS_0?
s->seen_error = true;
} else if (md_key_cmp(md, GRPC_MDSTR_GRPC_TIMEOUT)) {
if (md_key_cmp(md, GRPC_MDSTR_GRPC_TIMEOUT)) {
return handle_timeout(s, md);
}
@ -534,10 +511,6 @@ static grpc_error* on_trailing_header(void* tp, grpc_mdelem md) {
gpr_free(value);
}
if (is_nonzero_status(md)) { // not GRPC_MDELEM_GRPC_STATUS_0?
s->seen_error = true;
}
const size_t new_size = s->metadata_buffer[1].size + GRPC_MDELEM_LENGTH(md);
const size_t metadata_size_limit =
t->settings[GRPC_ACKED_SETTINGS]

@ -202,11 +202,6 @@ struct inproc_stream {
}
t->unref();
if (closure_at_destroy) {
grpc_core::ExecCtx::Run(DEBUG_LOCATION, closure_at_destroy,
GRPC_ERROR_NONE);
}
}
#ifndef NDEBUG
@ -249,7 +244,6 @@ struct inproc_stream {
bool other_side_closed = false; // won't talk anymore
bool write_buffer_other_side_closed = false; // on hold
grpc_stream_refcount* refs;
grpc_closure* closure_at_destroy = nullptr;
grpc_core::Arena* arena;
@ -1183,12 +1177,17 @@ void perform_transport_op(grpc_transport* gt, grpc_transport_op* op) {
gpr_mu_unlock(&t->mu->mu);
}
void destroy_stream(grpc_transport* /*gt*/, grpc_stream* gs,
void destroy_stream(grpc_transport* gt, grpc_stream* gs,
grpc_closure* then_schedule_closure) {
INPROC_LOG(GPR_INFO, "destroy_stream %p %p", gs, then_schedule_closure);
inproc_transport* t = reinterpret_cast<inproc_transport*>(gt);
inproc_stream* s = reinterpret_cast<inproc_stream*>(gs);
s->closure_at_destroy = then_schedule_closure;
gpr_mu_lock(&t->mu->mu);
close_stream_locked(s);
gpr_mu_unlock(&t->mu->mu);
s->~inproc_stream();
grpc_core::ExecCtx::Run(DEBUG_LOCATION, then_schedule_closure,
GRPC_ERROR_NONE);
}
void destroy_transport(grpc_transport* gt) {

@ -0,0 +1,43 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* third_party/istio/security/proto/providers/google/meshca.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#include <stddef.h>
#include "upb/msg.h"
#include "third_party/istio/security/proto/providers/google/meshca.upb.h"
#include "google/protobuf/duration.upb.h"
#include "upb/port_def.inc"
static const upb_msglayout *const google_security_meshca_v1_MeshCertificateRequest_submsgs[1] = {
&google_protobuf_Duration_msginit,
};
static const upb_msglayout_field google_security_meshca_v1_MeshCertificateRequest__fields[3] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 1},
{2, UPB_SIZE(8, 16), 0, 0, 9, 1},
{3, UPB_SIZE(16, 32), 0, 0, 11, 1},
};
const upb_msglayout google_security_meshca_v1_MeshCertificateRequest_msginit = {
&google_security_meshca_v1_MeshCertificateRequest_submsgs[0],
&google_security_meshca_v1_MeshCertificateRequest__fields[0],
UPB_SIZE(24, 48), 3, false,
};
static const upb_msglayout_field google_security_meshca_v1_MeshCertificateResponse__fields[1] = {
{1, UPB_SIZE(0, 0), 0, 0, 9, 3},
};
const upb_msglayout google_security_meshca_v1_MeshCertificateResponse_msginit = {
NULL,
&google_security_meshca_v1_MeshCertificateResponse__fields[0],
UPB_SIZE(4, 8), 1, false,
};
#include "upb/port_undef.inc"

@ -0,0 +1,103 @@
/* This file was generated by upbc (the upb compiler) from the input
* file:
*
* third_party/istio/security/proto/providers/google/meshca.proto
*
* Do not edit -- your changes will be discarded when the file is
* regenerated. */
#ifndef THIRD_PARTY_ISTIO_SECURITY_PROTO_PROVIDERS_GOOGLE_MESHCA_PROTO_UPB_H_
#define THIRD_PARTY_ISTIO_SECURITY_PROTO_PROVIDERS_GOOGLE_MESHCA_PROTO_UPB_H_
#include "upb/msg.h"
#include "upb/decode.h"
#include "upb/encode.h"
#include "upb/port_def.inc"
#ifdef __cplusplus
extern "C" {
#endif
struct google_security_meshca_v1_MeshCertificateRequest;
struct google_security_meshca_v1_MeshCertificateResponse;
typedef struct google_security_meshca_v1_MeshCertificateRequest google_security_meshca_v1_MeshCertificateRequest;
typedef struct google_security_meshca_v1_MeshCertificateResponse google_security_meshca_v1_MeshCertificateResponse;
extern const upb_msglayout google_security_meshca_v1_MeshCertificateRequest_msginit;
extern const upb_msglayout google_security_meshca_v1_MeshCertificateResponse_msginit;
struct google_protobuf_Duration;
extern const upb_msglayout google_protobuf_Duration_msginit;
/* google.security.meshca.v1.MeshCertificateRequest */
UPB_INLINE google_security_meshca_v1_MeshCertificateRequest *google_security_meshca_v1_MeshCertificateRequest_new(upb_arena *arena) {
return (google_security_meshca_v1_MeshCertificateRequest *)_upb_msg_new(&google_security_meshca_v1_MeshCertificateRequest_msginit, arena);
}
UPB_INLINE google_security_meshca_v1_MeshCertificateRequest *google_security_meshca_v1_MeshCertificateRequest_parse(const char *buf, size_t size,
upb_arena *arena) {
google_security_meshca_v1_MeshCertificateRequest *ret = google_security_meshca_v1_MeshCertificateRequest_new(arena);
return (ret && upb_decode(buf, size, ret, &google_security_meshca_v1_MeshCertificateRequest_msginit, arena)) ? ret : NULL;
}
UPB_INLINE char *google_security_meshca_v1_MeshCertificateRequest_serialize(const google_security_meshca_v1_MeshCertificateRequest *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &google_security_meshca_v1_MeshCertificateRequest_msginit, arena, len);
}
UPB_INLINE upb_strview google_security_meshca_v1_MeshCertificateRequest_request_id(const google_security_meshca_v1_MeshCertificateRequest *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview); }
UPB_INLINE upb_strview google_security_meshca_v1_MeshCertificateRequest_csr(const google_security_meshca_v1_MeshCertificateRequest *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(8, 16), upb_strview); }
UPB_INLINE bool google_security_meshca_v1_MeshCertificateRequest_has_validity(const google_security_meshca_v1_MeshCertificateRequest *msg) { return _upb_has_submsg_nohasbit(msg, UPB_SIZE(16, 32)); }
UPB_INLINE const struct google_protobuf_Duration* google_security_meshca_v1_MeshCertificateRequest_validity(const google_security_meshca_v1_MeshCertificateRequest *msg) { return *UPB_PTR_AT(msg, UPB_SIZE(16, 32), const struct google_protobuf_Duration*); }
UPB_INLINE void google_security_meshca_v1_MeshCertificateRequest_set_request_id(google_security_meshca_v1_MeshCertificateRequest *msg, upb_strview value) {
*UPB_PTR_AT(msg, UPB_SIZE(0, 0), upb_strview) = value;
}
UPB_INLINE void google_security_meshca_v1_MeshCertificateRequest_set_csr(google_security_meshca_v1_MeshCertificateRequest *msg, upb_strview value) {
*UPB_PTR_AT(msg, UPB_SIZE(8, 16), upb_strview) = value;
}
UPB_INLINE void google_security_meshca_v1_MeshCertificateRequest_set_validity(google_security_meshca_v1_MeshCertificateRequest *msg, struct google_protobuf_Duration* value) {
*UPB_PTR_AT(msg, UPB_SIZE(16, 32), struct google_protobuf_Duration*) = value;
}
UPB_INLINE struct google_protobuf_Duration* google_security_meshca_v1_MeshCertificateRequest_mutable_validity(google_security_meshca_v1_MeshCertificateRequest *msg, upb_arena *arena) {
struct google_protobuf_Duration* sub = (struct google_protobuf_Duration*)google_security_meshca_v1_MeshCertificateRequest_validity(msg);
if (sub == NULL) {
sub = (struct google_protobuf_Duration*)_upb_msg_new(&google_protobuf_Duration_msginit, arena);
if (!sub) return NULL;
google_security_meshca_v1_MeshCertificateRequest_set_validity(msg, sub);
}
return sub;
}
/* google.security.meshca.v1.MeshCertificateResponse */
UPB_INLINE google_security_meshca_v1_MeshCertificateResponse *google_security_meshca_v1_MeshCertificateResponse_new(upb_arena *arena) {
return (google_security_meshca_v1_MeshCertificateResponse *)_upb_msg_new(&google_security_meshca_v1_MeshCertificateResponse_msginit, arena);
}
UPB_INLINE google_security_meshca_v1_MeshCertificateResponse *google_security_meshca_v1_MeshCertificateResponse_parse(const char *buf, size_t size,
upb_arena *arena) {
google_security_meshca_v1_MeshCertificateResponse *ret = google_security_meshca_v1_MeshCertificateResponse_new(arena);
return (ret && upb_decode(buf, size, ret, &google_security_meshca_v1_MeshCertificateResponse_msginit, arena)) ? ret : NULL;
}
UPB_INLINE char *google_security_meshca_v1_MeshCertificateResponse_serialize(const google_security_meshca_v1_MeshCertificateResponse *msg, upb_arena *arena, size_t *len) {
return upb_encode(msg, &google_security_meshca_v1_MeshCertificateResponse_msginit, arena, len);
}
UPB_INLINE upb_strview const* google_security_meshca_v1_MeshCertificateResponse_cert_chain(const google_security_meshca_v1_MeshCertificateResponse *msg, size_t *len) { return (upb_strview const*)_upb_array_accessor(msg, UPB_SIZE(0, 0), len); }
UPB_INLINE upb_strview* google_security_meshca_v1_MeshCertificateResponse_mutable_cert_chain(google_security_meshca_v1_MeshCertificateResponse *msg, size_t *len) {
return (upb_strview*)_upb_array_mutable_accessor(msg, UPB_SIZE(0, 0), len);
}
UPB_INLINE upb_strview* google_security_meshca_v1_MeshCertificateResponse_resize_cert_chain(google_security_meshca_v1_MeshCertificateResponse *msg, size_t len, upb_arena *arena) {
return (upb_strview*)_upb_array_resize_accessor(msg, UPB_SIZE(0, 0), len, UPB_TYPE_STRING, arena);
}
UPB_INLINE bool google_security_meshca_v1_MeshCertificateResponse_add_cert_chain(google_security_meshca_v1_MeshCertificateResponse *msg, upb_strview val, upb_arena *arena) {
return _upb_array_append_accessor(msg, UPB_SIZE(0, 0), UPB_SIZE(8, 16), UPB_TYPE_STRING, &val,
arena);
}
#ifdef __cplusplus
} /* extern "C" */
#endif
#include "upb/port_undef.inc"
#endif /* THIRD_PARTY_ISTIO_SECURITY_PROTO_PROVIDERS_GOOGLE_MESHCA_PROTO_UPB_H_ */

@ -1022,6 +1022,13 @@ void XdsClient::ChannelState::AdsCallState::AcceptCdsUpdate(
const std::string& cluster_name = p.first;
if (cds_update_map.find(cluster_name) == cds_update_map.end()) {
ClusterState& cluster_state = xds_client()->cluster_map_[cluster_name];
// If the resource was newly requested but has not yet been received,
// we don't want to generate an error for the watchers, because this CDS
// response may be in reaction to an earlier request that did not yet
// request the new resource, so its absence from the response does not
// necessarily indicate that the resource does not exist.
// For that case, we rely on the request timeout instead.
if (!cluster_state.update.has_value()) continue;
cluster_state.update.reset();
for (const auto& p : cluster_state.watchers) {
p.first->OnResourceDoesNotExist();

@ -18,8 +18,8 @@
#include <grpc/support/port_platform.h>
#include "src/core/ext/filters/client_channel/parse_address.h"
#include "src/core/lib/iomgr/grpc_if_nametoindex.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/socket_utils.h"

@ -16,8 +16,8 @@
*
*/
#ifndef GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H
#define GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H
#ifndef GRPC_CORE_LIB_IOMGR_PARSE_ADDRESS_H
#define GRPC_CORE_LIB_IOMGR_PARSE_ADDRESS_H
#include <grpc/support/port_platform.h>
@ -50,4 +50,4 @@ bool grpc_parse_ipv6_hostport(const char* hostport, grpc_resolved_address* addr,
/* Converts named or numeric port to a uint16 suitable for use in a sockaddr. */
uint16_t grpc_strhtons(const char* port);
#endif /* GRPC_CORE_EXT_FILTERS_CLIENT_CHANNEL_PARSE_ADDRESS_H */
#endif /* GRPC_CORE_LIB_IOMGR_PARSE_ADDRESS_H */

@ -20,6 +20,22 @@
namespace grpc_core {
namespace {
// Symbols for traversing Envoy Attributes
constexpr char kUrlPath[] = "url_path";
constexpr char kHost[] = "host";
constexpr char kMethod[] = "method";
constexpr char kHeaders[] = "headers";
constexpr char kSourceAddress[] = "source_address";
constexpr char kSourcePort[] = "source_port";
constexpr char kDestinationAddress[] = "destination_address";
constexpr char kDestinationPort[] = "destination_port";
constexpr char kSpiffeId[] = "spiffe_id";
constexpr char kCertServerName[] = "cert_server_name";
} // namespace
std::unique_ptr<AuthorizationEngine>
AuthorizationEngine::CreateAuthorizationEngine(
const std::vector<envoy_config_rbac_v3_RBAC*>& rbac_policies) {
@ -74,4 +90,88 @@ AuthorizationEngine::AuthorizationEngine(
}
}
std::unique_ptr<mock_cel::Activation> AuthorizationEngine::CreateActivation(
const EvaluateArgs& args) {
std::unique_ptr<mock_cel::Activation> activation;
for (const auto& elem : envoy_attributes_) {
if (elem == kUrlPath) {
absl::string_view url_path(args.GetPath());
if (!url_path.empty()) {
activation->InsertValue(kUrlPath,
mock_cel::CelValue::CreateStringView(url_path));
}
} else if (elem == kHost) {
absl::string_view host(args.GetHost());
if (!host.empty()) {
activation->InsertValue(kHost,
mock_cel::CelValue::CreateStringView(host));
}
} else if (elem == kMethod) {
absl::string_view method(args.GetMethod());
if (!method.empty()) {
activation->InsertValue(kMethod,
mock_cel::CelValue::CreateStringView(method));
}
} else if (elem == kHeaders) {
std::multimap<absl::string_view, absl::string_view> headers =
args.GetHeaders();
std::vector<std::pair<mock_cel::CelValue, mock_cel::CelValue>>
header_items;
for (const auto& header_key : header_keys_) {
auto header_item = headers.find(header_key);
if (header_item != headers.end()) {
header_items.push_back(
std::pair<mock_cel::CelValue, mock_cel::CelValue>(
mock_cel::CelValue::CreateStringView(header_key),
mock_cel::CelValue::CreateStringView(header_item->second)));
}
}
headers_ = mock_cel::ContainerBackedMapImpl::Create(
absl::Span<std::pair<mock_cel::CelValue, mock_cel::CelValue>>(
header_items));
activation->InsertValue(kHeaders,
mock_cel::CelValue::CreateMap(headers_.get()));
} else if (elem == kSourceAddress) {
absl::string_view source_address(args.GetPeerAddress());
if (!source_address.empty()) {
activation->InsertValue(
kSourceAddress,
mock_cel::CelValue::CreateStringView(source_address));
}
} else if (elem == kSourcePort) {
activation->InsertValue(
kSourcePort, mock_cel::CelValue::CreateInt64(args.GetPeerPort()));
} else if (elem == kDestinationAddress) {
absl::string_view destination_address(args.GetLocalAddress());
if (!destination_address.empty()) {
activation->InsertValue(
kDestinationAddress,
mock_cel::CelValue::CreateStringView(destination_address));
}
} else if (elem == kDestinationPort) {
activation->InsertValue(kDestinationPort, mock_cel::CelValue::CreateInt64(
args.GetLocalPort()));
} else if (elem == kSpiffeId) {
absl::string_view spiffe_id(args.GetSpiffeId());
if (!spiffe_id.empty()) {
activation->InsertValue(
kSpiffeId, mock_cel::CelValue::CreateStringView(spiffe_id));
}
} else if (elem == kCertServerName) {
absl::string_view cert_server_name(args.GetCertServerName());
if (!cert_server_name.empty()) {
activation->InsertValue(
kCertServerName,
mock_cel::CelValue::CreateStringView(cert_server_name));
}
} else {
gpr_log(GPR_ERROR,
"Error: Authorization engine does not support evaluating "
"attribute %s.",
elem.c_str());
}
}
return activation;
}
} // namespace grpc_core

@ -24,10 +24,14 @@
#include <string>
#include <vector>
#include "src/core/ext/upb-generated/envoy/config/rbac/v3/rbac.upb.h"
#include "src/core/ext/upb-generated/google/api/expr/v1alpha1/syntax.upb.h"
#include "absl/container/flat_hash_set.h"
#include "envoy/config/rbac/v3/rbac.upb.h"
#include "google/api/expr/v1alpha1/syntax.upb.h"
#include "upb/upb.hpp"
#include "src/core/lib/security/authorization/evaluate_args.h"
#include "src/core/lib/security/authorization/mock_cel/activation.h"
namespace grpc_core {
// AuthorizationEngine makes an AuthorizationDecision to ALLOW or DENY the
@ -62,11 +66,17 @@ class AuthorizationEngine {
kDeny,
};
std::unique_ptr<mock_cel::Activation> CreateActivation(
const EvaluateArgs& args);
std::map<const std::string, const google_api_expr_v1alpha1_Expr*>
deny_if_matched_;
std::map<const std::string, const google_api_expr_v1alpha1_Expr*>
allow_if_matched_;
upb::Arena arena_;
absl::flat_hash_set<std::string> envoy_attributes_;
absl::flat_hash_set<std::string> header_keys_;
std::unique_ptr<mock_cel::CelMap> headers_;
};
} // namespace grpc_core

@ -0,0 +1,153 @@
//
//
// Copyright 2020 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.
//
//
#include <grpc/support/port_platform.h>
#include "src/core/lib/security/authorization/evaluate_args.h"
#include "src/core/lib/iomgr/parse_address.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/slice/slice_utils.h"
namespace grpc_core {
absl::string_view EvaluateArgs::GetPath() const {
absl::string_view path;
if (metadata_ != nullptr && metadata_->idx.named.path != nullptr) {
grpc_linked_mdelem* elem = metadata_->idx.named.path;
const grpc_slice& val = GRPC_MDVALUE(elem->md);
path = StringViewFromSlice(val);
}
return path;
}
absl::string_view EvaluateArgs::GetHost() const {
absl::string_view host;
if (metadata_ != nullptr && metadata_->idx.named.host != nullptr) {
grpc_linked_mdelem* elem = metadata_->idx.named.host;
const grpc_slice& val = GRPC_MDVALUE(elem->md);
host = StringViewFromSlice(val);
}
return host;
}
absl::string_view EvaluateArgs::GetMethod() const {
absl::string_view method;
if (metadata_ != nullptr && metadata_->idx.named.method != nullptr) {
grpc_linked_mdelem* elem = metadata_->idx.named.method;
const grpc_slice& val = GRPC_MDVALUE(elem->md);
method = StringViewFromSlice(val);
}
return method;
}
std::multimap<absl::string_view, absl::string_view> EvaluateArgs::GetHeaders()
const {
std::multimap<absl::string_view, absl::string_view> headers;
if (metadata_ == nullptr) {
return headers;
}
for (grpc_linked_mdelem* elem = metadata_->list.head; elem != nullptr;
elem = elem->next) {
const grpc_slice& key = GRPC_MDKEY(elem->md);
const grpc_slice& val = GRPC_MDVALUE(elem->md);
headers.emplace(StringViewFromSlice(key), StringViewFromSlice(val));
}
return headers;
}
absl::string_view EvaluateArgs::GetLocalAddress() const {
absl::string_view addr = grpc_endpoint_get_local_address(endpoint_);
size_t first_colon = addr.find(":");
size_t last_colon = addr.rfind(":");
if (first_colon == std::string::npos || last_colon == std::string::npos) {
return "";
} else {
return addr.substr(first_colon + 1, last_colon - first_colon - 1);
}
}
int EvaluateArgs::GetLocalPort() const {
if (endpoint_ == nullptr) {
return 0;
}
grpc_uri* uri = grpc_uri_parse(
std::string(grpc_endpoint_get_local_address(endpoint_)).c_str(), true);
grpc_resolved_address resolved_addr;
if (uri == nullptr || !grpc_parse_uri(uri, &resolved_addr)) {
grpc_uri_destroy(uri);
return 0;
}
grpc_uri_destroy(uri);
return grpc_sockaddr_get_port(&resolved_addr);
}
absl::string_view EvaluateArgs::GetPeerAddress() const {
absl::string_view addr = grpc_endpoint_get_peer(endpoint_);
size_t first_colon = addr.find(":");
size_t last_colon = addr.rfind(":");
if (first_colon == std::string::npos || last_colon == std::string::npos) {
return "";
} else {
return addr.substr(first_colon + 1, last_colon - first_colon - 1);
}
}
int EvaluateArgs::GetPeerPort() const {
if (endpoint_ == nullptr) {
return 0;
}
grpc_uri* uri = grpc_uri_parse(
std::string(grpc_endpoint_get_peer(endpoint_)).c_str(), true);
grpc_resolved_address resolved_addr;
if (uri == nullptr || !grpc_parse_uri(uri, &resolved_addr)) {
grpc_uri_destroy(uri);
return 0;
}
grpc_uri_destroy(uri);
return grpc_sockaddr_get_port(&resolved_addr);
}
absl::string_view EvaluateArgs::GetSpiffeId() const {
if (auth_context_ == nullptr) {
return "";
}
grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name(
auth_context_, GRPC_PEER_SPIFFE_ID_PROPERTY_NAME);
const grpc_auth_property* prop = grpc_auth_property_iterator_next(&it);
if (prop == nullptr || grpc_auth_property_iterator_next(&it) != nullptr) {
return "";
}
return absl::string_view(prop->value, prop->value_length);
}
absl::string_view EvaluateArgs::GetCertServerName() const {
if (auth_context_ == nullptr) {
return "";
}
grpc_auth_property_iterator it = grpc_auth_context_find_properties_by_name(
auth_context_, GRPC_X509_CN_PROPERTY_NAME);
const grpc_auth_property* prop = grpc_auth_property_iterator_next(&it);
if (prop == nullptr || grpc_auth_property_iterator_next(&it) != nullptr) {
return "";
}
return absl::string_view(prop->value, prop->value_length);
}
} // namespace grpc_core

@ -0,0 +1,59 @@
//
//
// Copyright 2020 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.
//
//
#ifndef GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H
#define GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H
#include <grpc/support/port_platform.h>
#include <map>
#include "src/core/lib/iomgr/endpoint.h"
#include "src/core/lib/security/context/security_context.h"
#include "src/core/lib/transport/metadata_batch.h"
namespace grpc_core {
class EvaluateArgs {
public:
EvaluateArgs(grpc_metadata_batch* metadata, grpc_auth_context* auth_context,
grpc_endpoint* endpoint)
: metadata_(metadata), auth_context_(auth_context), endpoint_(endpoint) {}
absl::string_view GetPath() const;
absl::string_view GetHost() const;
absl::string_view GetMethod() const;
std::multimap<absl::string_view, absl::string_view> GetHeaders() const;
absl::string_view GetLocalAddress() const;
int GetLocalPort() const;
absl::string_view GetPeerAddress() const;
int GetPeerPort() const;
absl::string_view GetSpiffeId() const;
absl::string_view GetCertServerName() const;
// TODO: Add a getter function for source.principal
private:
grpc_metadata_batch* metadata_;
grpc_auth_context* auth_context_;
grpc_endpoint* endpoint_;
};
} // namespace grpc_core
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_EVALUATE_ARGS_H

@ -21,10 +21,8 @@
#include "src/core/lib/security/authorization/mock_cel/cel_value.h"
namespace google {
namespace api {
namespace expr {
namespace runtime {
namespace grpc_core {
namespace mock_cel {
// Base class for an activation. This is a temporary stub implementation of CEL
// APIs. Once gRPC imports the CEL library, this class will be removed.
@ -53,9 +51,7 @@ class Activation : public BaseActivation {
void InsertValue(absl::string_view name, const CelValue& value) {}
};
} // namespace runtime
} // namespace expr
} // namespace api
} // namespace google
} // namespace mock_cel
} // namespace grpc_core
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_ACTIVATION_H

@ -34,13 +34,14 @@
#include "absl/strings/string_view.h"
namespace google {
namespace api {
namespace expr {
namespace runtime {
namespace grpc_core {
namespace mock_cel {
// Break cyclic depdendencies for container types.
class CelMap;
class CelMap {
public:
CelMap() = default;
};
// This is a temporary stub implementation of CEL APIs.
// Once gRPC imports the CEL library, this class will be removed.
@ -75,9 +76,18 @@ class CelValue {
explicit CelValue(T value) {}
};
} // namespace runtime
} // namespace expr
} // namespace api
} // namespace google
// CelMap implementation that uses STL map container as backing storage.
class ContainerBackedMapImpl : public CelMap {
public:
ContainerBackedMapImpl() = default;
static std::unique_ptr<CelMap> Create(
absl::Span<std::pair<CelValue, CelValue>> key_values) {
return absl::make_unique<ContainerBackedMapImpl>();
}
};
} // namespace mock_cel
} // namespace grpc_core
#endif // GRPC_CORE_LIB_SECURITY_AUTHORIZATION_MOCK_CEL_CEL_VALUE_H

@ -415,26 +415,33 @@ grpc_call* grpc_channel_create_pollset_set_call(
namespace grpc_core {
RegisteredCall::RegisteredCall(const char* method, const char* host) {
path = grpc_mdelem_from_slices(GRPC_MDSTR_PATH,
grpc_core::ExternallyManagedSlice(method));
authority =
host ? grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
grpc_core::ExternallyManagedSlice(host))
: GRPC_MDNULL;
}
RegisteredCall::RegisteredCall(const char* method_arg, const char* host_arg)
: method(method_arg != nullptr ? method_arg : ""),
host(host_arg != nullptr ? host_arg : ""),
path(grpc_mdelem_from_slices(
GRPC_MDSTR_PATH, grpc_core::ExternallyManagedSlice(method.c_str()))),
authority(!host.empty()
? grpc_mdelem_from_slices(
GRPC_MDSTR_AUTHORITY,
grpc_core::ExternallyManagedSlice(host.c_str()))
: GRPC_MDNULL) {}
// TODO(vjpai): Delete copy-constructor when allowed by all supported compilers.
RegisteredCall::RegisteredCall(const RegisteredCall& other) {
path = other.path;
authority = other.authority;
GRPC_MDELEM_REF(path);
GRPC_MDELEM_REF(authority);
}
RegisteredCall::RegisteredCall(RegisteredCall&& other) noexcept {
path = other.path;
authority = other.authority;
RegisteredCall::RegisteredCall(const RegisteredCall& other)
: RegisteredCall(other.method.c_str(), other.host.c_str()) {}
RegisteredCall::RegisteredCall(RegisteredCall&& other) noexcept
: method(std::move(other.method)),
host(std::move(other.host)),
path(grpc_mdelem_from_slices(
GRPC_MDSTR_PATH, grpc_core::ExternallyManagedSlice(method.c_str()))),
authority(!host.empty()
? grpc_mdelem_from_slices(
GRPC_MDSTR_AUTHORITY,
grpc_core::ExternallyManagedSlice(host.c_str()))
: GRPC_MDNULL) {
GRPC_MDELEM_UNREF(other.path);
GRPC_MDELEM_UNREF(other.authority);
other.path = GRPC_MDNULL;
other.authority = GRPC_MDNULL;
}
@ -457,13 +464,14 @@ void* grpc_channel_register_call(grpc_channel* channel, const char* method,
grpc_core::MutexLock lock(&channel->registration_table->mu);
channel->registration_table->method_registration_attempts++;
auto key = std::make_pair(host, method);
auto key = std::make_pair(std::string(host != nullptr ? host : ""),
std::string(method != nullptr ? method : ""));
auto rc_posn = channel->registration_table->map.find(key);
if (rc_posn != channel->registration_table->map.end()) {
return &rc_posn->second;
}
auto insertion_result = channel->registration_table->map.insert(
{key, grpc_core::RegisteredCall(method, host)});
{std::move(key), grpc_core::RegisteredCall(method, host)});
return &insertion_result.first->second;
}

@ -69,21 +69,31 @@ void grpc_channel_update_call_size_estimate(grpc_channel* channel, size_t size);
namespace grpc_core {
struct RegisteredCall {
// The method and host are kept as part of this struct just to manage their
// lifetime since they must outlive the mdelem contents.
std::string method;
std::string host;
grpc_mdelem path;
grpc_mdelem authority;
explicit RegisteredCall(const char* method, const char* host);
explicit RegisteredCall(const char* method_arg, const char* host_arg);
// TODO(vjpai): delete copy constructor once all supported compilers allow
// std::map value_type to be MoveConstructible.
RegisteredCall(const RegisteredCall& other);
RegisteredCall(RegisteredCall&& other) noexcept;
RegisteredCall& operator=(const RegisteredCall&) = delete;
RegisteredCall& operator=(RegisteredCall&&) = delete;
~RegisteredCall();
};
struct CallRegistrationTable {
grpc_core::Mutex mu;
std::map<std::pair<const char*, const char*>, RegisteredCall>
// The map key should be owned strings rather than unowned char*'s to
// guarantee that it outlives calls on the core channel (which may outlast the
// C++ or other wrapped language Channel that registered these calls).
std::map<std::pair<std::string, std::string>, RegisteredCall>
map /* GUARDED_BY(mu) */;
int method_registration_attempts /* GUARDED_BY(mu) */ = 0;
};

@ -459,4 +459,11 @@ grpc_transport_op* grpc_make_transport_op(grpc_closure* on_consumed);
grpc_transport_stream_op_batch* grpc_make_transport_stream_op(
grpc_closure* on_consumed);
namespace grpc_core {
// This is the key to be used for loading/storing keepalive_throttling in the
// absl::Status object.
constexpr const char* kKeepaliveThrottlingKey =
"grpc.internal.keepalive_throttling";
} // namespace grpc_core
#endif /* GRPC_CORE_LIB_TRANSPORT_TRANSPORT_H */

@ -38,11 +38,12 @@
/** a size_t default value... maps to all 1's */
#define NOT_SET (~(size_t)0)
static grpc_uri* bad_uri(const char* uri_text, size_t pos, const char* section,
bool suppress_errors) {
static grpc_uri* bad_uri(absl::string_view uri_text, size_t pos,
const char* section, bool suppress_errors) {
if (!suppress_errors) {
std::string line_prefix = absl::StrFormat("bad uri.%s: '", section);
gpr_log(GPR_ERROR, "%s%s'", line_prefix.c_str(), uri_text);
gpr_log(GPR_ERROR, "%s%s'", line_prefix.c_str(),
std::string(uri_text).c_str());
size_t pfx_len = line_prefix.size() + pos;
gpr_log(GPR_ERROR, "%s^ here", std::string(pfx_len, ' ').c_str());
}
@ -50,12 +51,12 @@ static grpc_uri* bad_uri(const char* uri_text, size_t pos, const char* section,
}
/** Returns a copy of percent decoded \a src[begin, end) */
static char* decode_and_copy_component(const char* src, size_t begin,
static char* decode_and_copy_component(absl::string_view src, size_t begin,
size_t end) {
grpc_slice component =
(begin == NOT_SET || end == NOT_SET)
? grpc_empty_slice()
: grpc_slice_from_copied_buffer(src + begin, end - begin);
: grpc_slice_from_copied_buffer(src.data() + begin, end - begin);
grpc_slice decoded_component =
grpc_permissive_percent_decode_slice(component);
char* out = grpc_dump_slice(decoded_component, GPR_DUMP_ASCII);
@ -72,7 +73,7 @@ static bool valid_hex(char c) {
/** Returns how many chars to advance if \a uri_text[i] begins a valid \a pchar
* production. If \a uri_text[i] introduces an invalid \a pchar (such as percent
* sign not followed by two hex digits), NOT_SET is returned. */
static size_t parse_pchar(const char* uri_text, size_t i) {
static size_t parse_pchar(absl::string_view uri_text, size_t i) {
/* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
* pct-encoded = "%" HEXDIG HEXDIG
@ -105,7 +106,8 @@ static size_t parse_pchar(const char* uri_text, size_t i) {
case '=':
return 1;
case '%': /* pct-encoded */
if (valid_hex(uri_text[i + 1]) && valid_hex(uri_text[i + 2])) {
if (uri_text.size() > i + 2 && valid_hex(uri_text[i + 1]) &&
valid_hex(uri_text[i + 2])) {
return 2;
}
return NOT_SET;
@ -114,9 +116,8 @@ static size_t parse_pchar(const char* uri_text, size_t i) {
}
/* *( pchar / "?" / "/" ) */
static int parse_fragment_or_query(const char* uri_text, size_t* i) {
char c;
while ((c = uri_text[*i]) != 0) {
static int parse_fragment_or_query(absl::string_view uri_text, size_t* i) {
while (uri_text.size() > *i) {
const size_t advance = parse_pchar(uri_text, *i); /* pchar */
switch (advance) {
case 0: /* uri_text[i] isn't in pchar */
@ -178,7 +179,7 @@ static void parse_query_parts(grpc_uri* uri) {
}
}
grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors) {
grpc_uri* grpc_uri_parse(absl::string_view uri_text, bool suppress_errors) {
grpc_uri* uri;
size_t scheme_begin = 0;
size_t scheme_end = NOT_SET;
@ -192,7 +193,7 @@ grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors) {
size_t fragment_end = NOT_SET;
size_t i;
for (i = scheme_begin; uri_text[i] != 0; i++) {
for (i = scheme_begin; i < uri_text.size(); ++i) {
if (uri_text[i] == ':') {
scheme_end = i;
break;
@ -211,15 +212,16 @@ grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors) {
return bad_uri(uri_text, i, "scheme", suppress_errors);
}
if (uri_text[scheme_end + 1] == '/' && uri_text[scheme_end + 2] == '/') {
if (uri_text.size() > scheme_end + 2 && uri_text[scheme_end + 1] == '/' &&
uri_text[scheme_end + 2] == '/') {
authority_begin = scheme_end + 3;
for (i = authority_begin; uri_text[i] != 0 && authority_end == NOT_SET;
for (i = authority_begin; uri_text.size() > i && authority_end == NOT_SET;
i++) {
if (uri_text[i] == '/' || uri_text[i] == '?' || uri_text[i] == '#') {
authority_end = i;
}
}
if (authority_end == NOT_SET && uri_text[i] == 0) {
if (authority_end == NOT_SET && uri_text.size() == i) {
authority_end = i;
}
if (authority_end == NOT_SET) {
@ -231,34 +233,34 @@ grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors) {
path_begin = scheme_end + 1;
}
for (i = path_begin; uri_text[i] != 0; i++) {
for (i = path_begin; i < uri_text.size(); ++i) {
if (uri_text[i] == '?' || uri_text[i] == '#') {
path_end = i;
break;
}
}
if (path_end == NOT_SET && uri_text[i] == 0) {
if (path_end == NOT_SET && uri_text.size() == i) {
path_end = i;
}
if (path_end == NOT_SET) {
return bad_uri(uri_text, i, "path", suppress_errors);
}
if (uri_text[i] == '?') {
if (uri_text.size() > i && uri_text[i] == '?') {
query_begin = ++i;
if (!parse_fragment_or_query(uri_text, &i)) {
return bad_uri(uri_text, i, "query", suppress_errors);
} else if (uri_text[i] != 0 && uri_text[i] != '#') {
} else if (uri_text.size() > i && uri_text[i] != '#') {
/* We must be at the end or at the beginning of a fragment */
return bad_uri(uri_text, i, "query", suppress_errors);
}
query_end = i;
}
if (uri_text[i] == '#') {
if (uri_text.size() > i && uri_text[i] == '#') {
fragment_begin = ++i;
if (!parse_fragment_or_query(uri_text, &i)) {
return bad_uri(uri_text, i - fragment_end, "fragment", suppress_errors);
} else if (uri_text[i] != 0) {
} else if (uri_text.size() > i) {
/* We must be at the end */
return bad_uri(uri_text, i, "fragment", suppress_errors);
}

@ -21,6 +21,8 @@
#include <grpc/support/port_platform.h>
#include "absl/strings/string_view.h"
#include <stddef.h>
struct grpc_uri {
@ -37,7 +39,7 @@ struct grpc_uri {
char* fragment;
};
/** parse a uri, return NULL on failure */
grpc_uri* grpc_uri_parse(const char* uri_text, bool suppress_errors);
grpc_uri* grpc_uri_parse(absl::string_view uri_text, bool suppress_errors);
/** return the part of a query string after the '=' in "?key=xxx&...", or NULL
* if key is not present */

@ -334,6 +334,28 @@ tsi_result alts_tsi_handshaker_result_create(grpc_gcp_HandshakerResp* resp,
local_service_account);
grpc_gcp_AltsContext_set_peer_rpc_versions(
context, const_cast<grpc_gcp_RpcProtocolVersions*>(peer_rpc_version));
grpc_gcp_Identity* peer_identity = const_cast<grpc_gcp_Identity*>(identity);
if (peer_identity == nullptr) {
gpr_log(GPR_ERROR, "Null peer identity in ALTS context.");
return TSI_FAILED_PRECONDITION;
}
if (grpc_gcp_Identity_has_attributes(identity)) {
size_t iter = UPB_MAP_BEGIN;
grpc_gcp_Identity_AttributesEntry* peer_attributes_entry =
grpc_gcp_Identity_attributes_nextmutable(peer_identity, &iter);
while (peer_attributes_entry != nullptr) {
upb_strview key = grpc_gcp_Identity_AttributesEntry_key(
const_cast<grpc_gcp_Identity_AttributesEntry*>(
peer_attributes_entry));
upb_strview val = grpc_gcp_Identity_AttributesEntry_value(
const_cast<grpc_gcp_Identity_AttributesEntry*>(
peer_attributes_entry));
grpc_gcp_AltsContext_peer_attributes_set(context, key, val,
context_arena.ptr());
peer_attributes_entry =
grpc_gcp_Identity_attributes_nextmutable(peer_identity, &iter);
}
}
size_t serialized_ctx_length;
char* serialized_ctx = grpc_gcp_AltsContext_serialize(
context, context_arena.ptr(), &serialized_ctx_length);

@ -1894,11 +1894,8 @@ tsi_result tsi_create_ssl_client_handshaker_factory_with_options(
#else
ssl_context = SSL_CTX_new(TLSv1_2_method());
#endif
// TODO(mattstev): Re-enable TLS 1.3 by using |options.min_tls_version| and
// |options.max_tls_version|, rather than hardcoding in TLS 1.2 as the min and
// max.
result = tsi_set_min_and_max_tls_versions(
ssl_context, tsi_tls_version::TSI_TLS1_2, tsi_tls_version::TSI_TLS1_2);
ssl_context, options->min_tls_version, options->max_tls_version);
if (result != TSI_OK) return result;
if (ssl_context == nullptr) {
gpr_log(GPR_ERROR, "Could not create ssl context.");
@ -2064,12 +2061,9 @@ tsi_result tsi_create_ssl_server_handshaker_factory_with_options(
#else
impl->ssl_contexts[i] = SSL_CTX_new(TLSv1_2_method());
#endif
// TODO(mattstev): Re-enable TLS 1.3 by using |options.min_tls_version|
// and |options.max_tls_version|, rather than hardcoding in TLS 1.2 as the
// min and max.
result = tsi_set_min_and_max_tls_versions(impl->ssl_contexts[i],
tsi_tls_version::TSI_TLS1_2,
tsi_tls_version::TSI_TLS1_2);
options->min_tls_version,
options->max_tls_version);
if (result != TSI_OK) return result;
if (impl->ssl_contexts[i] == nullptr) {
gpr_log(GPR_ERROR, "Could not create ssl context.");

@ -34,8 +34,6 @@
namespace grpc {
class Channel;
} // namespace grpc
namespace grpc_impl {
class DefaultGlobalClientCallbacks final
: public ClientContext::GlobalCallbacks {
@ -45,7 +43,7 @@ class DefaultGlobalClientCallbacks final
void Destructor(ClientContext* /*context*/) override {}
};
static grpc::internal::GrpcLibraryInitializer g_gli_initializer;
static internal::GrpcLibraryInitializer g_gli_initializer;
static DefaultGlobalClientCallbacks* g_default_client_callbacks =
new DefaultGlobalClientCallbacks();
static ClientContext::GlobalCallbacks* g_client_callbacks =
@ -75,7 +73,7 @@ ClientContext::~ClientContext() {
}
void ClientContext::set_credentials(
const std::shared_ptr<grpc::CallCredentials>& creds) {
const std::shared_ptr<CallCredentials>& creds) {
creds_ = creds;
// If call_ is set, we have already created the call, and set the call
// credentials. This should only be done before we have started the batch
@ -116,8 +114,8 @@ void ClientContext::AddMetadata(const std::string& meta_key,
}
void ClientContext::set_call(grpc_call* call,
const std::shared_ptr<::grpc::Channel>& channel) {
grpc::internal::MutexLock lock(&mu_);
const std::shared_ptr<Channel>& channel) {
internal::MutexLock lock(&mu_);
GPR_ASSERT(call_ == nullptr);
call_ = call;
channel_ = channel;
@ -147,7 +145,7 @@ void ClientContext::set_compression_algorithm(
}
void ClientContext::TryCancel() {
grpc::internal::MutexLock lock(&mu_);
internal::MutexLock lock(&mu_);
if (call_) {
SendCancelToInterceptors();
grpc_call_cancel(call_, nullptr);
@ -157,7 +155,7 @@ void ClientContext::TryCancel() {
}
void ClientContext::SendCancelToInterceptors() {
grpc::internal::CancelInterceptorBatchMethods cancel_methods;
internal::CancelInterceptorBatchMethods cancel_methods;
for (size_t i = 0; i < rpc_info_.interceptors_.size(); i++) {
rpc_info_.RunInterceptor(&cancel_methods, i);
}
@ -180,4 +178,4 @@ void ClientContext::SetGlobalCallbacks(GlobalCallbacks* client_callbacks) {
g_client_callbacks = client_callbacks;
}
} // namespace grpc_impl
} // namespace grpc

@ -80,6 +80,21 @@ AltsContext::AltsContext(const grpc_gcp_AltsContext* ctx) {
security_level_ = static_cast<grpc_security_level>(
grpc_gcp_AltsContext_security_level(ctx));
}
if (grpc_gcp_AltsContext_has_peer_attributes(ctx)) {
size_t iter = UPB_MAP_BEGIN;
const grpc_gcp_AltsContext_PeerAttributesEntry* peer_attributes_entry =
grpc_gcp_AltsContext_peer_attributes_next(ctx, &iter);
while (peer_attributes_entry != nullptr) {
upb_strview key =
grpc_gcp_AltsContext_PeerAttributesEntry_key(peer_attributes_entry);
upb_strview val =
grpc_gcp_AltsContext_PeerAttributesEntry_value(peer_attributes_entry);
peer_attributes_map_[std::string(key.data, key.size)] =
std::string(val.data, val.size);
peer_attributes_entry =
grpc_gcp_AltsContext_peer_attributes_next(ctx, &iter);
}
}
}
std::string AltsContext::application_protocol() const {
@ -104,5 +119,9 @@ AltsContext::RpcProtocolVersions AltsContext::peer_rpc_versions() const {
return peer_rpc_versions_;
}
const std::map<std::string, std::string>& AltsContext::peer_attributes() const {
return peer_attributes_map_;
}
} // namespace experimental
} // namespace grpc

@ -57,6 +57,8 @@ void RegisterOpenCensusPlugin() {
::opencensus::trace::Span GetSpanFromServerContext(
grpc::ServerContext* context) {
if (context == nullptr) return opencensus::trace::Span::BlankSpan();
return reinterpret_cast<const grpc::CensusContext*>(context->census_context())
->Span();
}

@ -981,7 +981,10 @@ Server::~Server() {
}
}
}
// Destroy health check service before we destroy the C server so that
// it does not call grpc_server_request_registered_call() after the C
// server has been destroyed.
health_check_service_.reset();
grpc_server_destroy(server_);
}

@ -367,7 +367,7 @@ std::string ServerContextBase::peer() const {
}
const struct census_context* ServerContextBase::census_context() const {
return grpc_census_call_get_context(call_);
return call_ == nullptr ? nullptr : grpc_census_call_get_context(call_);
}
void ServerContextBase::SetLoadReportingCosts(

@ -0,0 +1,90 @@
#region Copyright notice and license
// Copyright 2020 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.
#endregion
using System;
using System.Threading.Tasks;
using System.IO;
using System.Linq;
using Grpc.Core;
using Grpc.Core.Internal;
using Grpc.Core.Utils;
using NUnit.Framework;
namespace Grpc.Core.Tests
{
public class ServerBindFailedTest
{
Method<string, string> UnimplementedMethod = new Method<string, string>(
MethodType.Unary,
"FooService",
"SomeNonExistentMethod",
Marshallers.StringMarshaller,
Marshallers.StringMarshaller);
// https://github.com/grpc/grpc/issues/18100
[Test]
public async Task Issue18100()
{
var server = new Server(new[] { new ChannelOption(ChannelOptions.SoReuseport, 0) });
// this port will successfully bind
int successfullyBoundPort = server.Ports.Add(new ServerPort("localhost", ServerPort.PickUnused, ServerCredentials.Insecure));
Assert.AreNotEqual(0, successfullyBoundPort);
// use bad ssl server credentials so this port is guaranteed to fail to bind
Assert.AreEqual(0, server.Ports.Add(new ServerPort("localhost", ServerPort.PickUnused, MakeBadSslServerCredentials())));
try
{
server.Start();
}
catch (IOException ex)
{
// eat the expected "Failed to bind port" exception.
Console.Error.WriteLine($"Ignoring expected exception when starting the server: {ex}");
}
// Create a channel to the port that has been bound successfully
var channel = new Channel("localhost", successfullyBoundPort, ChannelCredentials.Insecure);
var callDeadline = DateTime.UtcNow.AddSeconds(5); // set deadline to make sure we fail quickly if the server doesn't respond
// call a method that's not implemented on the server.
var call = Calls.AsyncUnaryCall(new CallInvocationDetails<string, string>(channel, UnimplementedMethod, new CallOptions(deadline: callDeadline)), "someRequest");
try
{
await call;
Assert.Fail("the call should have failed.");
}
catch (RpcException)
{
// We called a nonexistent method. A healthy server should immediately respond with StatusCode.Unimplemented
Assert.AreEqual(StatusCode.Unimplemented, call.GetStatus().StatusCode);
}
await channel.ShutdownAsync();
await server.ShutdownAsync();
}
private static SslServerCredentials MakeBadSslServerCredentials()
{
var serverCert = new[] { new KeyCertificatePair("this is a bad certificate chain", "this is a bad private key") };
return new SslServerCredentials(serverCert, "this is a bad root set", forceClientAuth: false);
}
}
}

@ -141,7 +141,9 @@ namespace Grpc.Core
/// <summary>
/// Starts the server.
/// Throws <c>IOException</c> if not successful.
/// Throws <c>IOException</c> if not all ports have been bound successfully (see <c>Ports.Add</c> method).
/// Even if some of that ports haven't been bound, the server will still serve normally on all ports that have been
/// bound successfully (and the user is expected to shutdown the server by invoking <c>ShutdownAsync</c> or <c>KillAsync</c>).
/// </summary>
public void Start()
{
@ -151,7 +153,6 @@ namespace Grpc.Core
GrpcPreconditions.CheckState(!shutdownRequested);
startRequested = true;
CheckPortsBoundSuccessfully();
handle.Start();
for (int i = 0; i < requestCallTokensPerCq; i++)
@ -161,6 +162,13 @@ namespace Grpc.Core
AllowOneRpc(cq);
}
}
// Throw if some ports weren't bound successfully.
// Even when that happens, some server ports might have been
// bound successfully, so we let server initialization
// proceed as usual and we only throw at the very end of the
// Start() method.
CheckPortsBoundSuccessfully();
}
}
@ -443,7 +451,7 @@ namespace Grpc.Core
/// <summary>
/// Adds a new port on which server should listen.
/// Only call this before Start().
/// <returns>The port on which server will be listening.</returns>
/// <returns>The port on which server will be listening. Return value of zero means that binding the port has failed.</returns>
/// </summary>
public int Add(ServerPort serverPort)
{
@ -452,7 +460,7 @@ namespace Grpc.Core
/// <summary>
/// Adds a new port on which server should listen.
/// <returns>The port on which server will be listening.</returns>
/// <returns>The port on which server will be listening. Return value of zero means that binding the port has failed.</returns>
/// </summary>
/// <param name="host">the host</param>
/// <param name="port">the port. If zero, an unused port is chosen automatically.</param>

@ -58,14 +58,22 @@ namespace Grpc.Testing {
"eF9yZWNvbm5lY3RfYmFja29mZl9tcxgBIAEoBSIzCg1SZWNvbm5lY3RJbmZv",
"Eg4KBnBhc3NlZBgBIAEoCBISCgpiYWNrb2ZmX21zGAIgAygFIkEKGExvYWRC",
"YWxhbmNlclN0YXRzUmVxdWVzdBIQCghudW1fcnBjcxgBIAEoBRITCgt0aW1l",
"b3V0X3NlYxgCIAEoBSKzAQoZTG9hZEJhbGFuY2VyU3RhdHNSZXNwb25zZRJN",
"b3V0X3NlYxgCIAEoBSKLBAoZTG9hZEJhbGFuY2VyU3RhdHNSZXNwb25zZRJN",
"CgxycGNzX2J5X3BlZXIYASADKAsyNy5ncnBjLnRlc3RpbmcuTG9hZEJhbGFu",
"Y2VyU3RhdHNSZXNwb25zZS5ScGNzQnlQZWVyRW50cnkSFAoMbnVtX2ZhaWx1",
"cmVzGAIgASgFGjEKD1JwY3NCeVBlZXJFbnRyeRILCgNrZXkYASABKAkSDQoF",
"dmFsdWUYAiABKAU6AjgBKh8KC1BheWxvYWRUeXBlEhAKDENPTVBSRVNTQUJM",
"RRAAKm8KD0dycGNsYlJvdXRlVHlwZRIdChlHUlBDTEJfUk9VVEVfVFlQRV9V",
"TktOT1dOEAASHgoaR1JQQ0xCX1JPVVRFX1RZUEVfRkFMTEJBQ0sQARIdChlH",
"UlBDTEJfUk9VVEVfVFlQRV9CQUNLRU5EEAJiBnByb3RvMw=="));
"cmVzGAIgASgFElEKDnJwY3NfYnlfbWV0aG9kGAMgAygLMjkuZ3JwYy50ZXN0",
"aW5nLkxvYWRCYWxhbmNlclN0YXRzUmVzcG9uc2UuUnBjc0J5TWV0aG9kRW50",
"cnkamQEKClJwY3NCeVBlZXISWAoMcnBjc19ieV9wZWVyGAEgAygLMkIuZ3Jw",
"Yy50ZXN0aW5nLkxvYWRCYWxhbmNlclN0YXRzUmVzcG9uc2UuUnBjc0J5UGVl",
"ci5ScGNzQnlQZWVyRW50cnkaMQoPUnBjc0J5UGVlckVudHJ5EgsKA2tleRgB",
"IAEoCRINCgV2YWx1ZRgCIAEoBToCOAEaMQoPUnBjc0J5UGVlckVudHJ5EgsK",
"A2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoBToCOAEaZwoRUnBjc0J5TWV0aG9k",
"RW50cnkSCwoDa2V5GAEgASgJEkEKBXZhbHVlGAIgASgLMjIuZ3JwYy50ZXN0",
"aW5nLkxvYWRCYWxhbmNlclN0YXRzUmVzcG9uc2UuUnBjc0J5UGVlcjoCOAEq",
"HwoLUGF5bG9hZFR5cGUSEAoMQ09NUFJFU1NBQkxFEAAqbwoPR3JwY2xiUm91",
"dGVUeXBlEh0KGUdSUENMQl9ST1VURV9UWVBFX1VOS05PV04QABIeChpHUlBD",
"TEJfUk9VVEVfVFlQRV9GQUxMQkFDSxABEh0KGUdSUENMQl9ST1VURV9UWVBF",
"X0JBQ0tFTkQQAmIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { },
new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Grpc.Testing.PayloadType), typeof(global::Grpc.Testing.GrpclbRouteType), }, null, new pbr::GeneratedClrTypeInfo[] {
@ -82,7 +90,8 @@ namespace Grpc.Testing {
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ReconnectParams), global::Grpc.Testing.ReconnectParams.Parser, new[]{ "MaxReconnectBackoffMs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.ReconnectInfo), global::Grpc.Testing.ReconnectInfo.Parser, new[]{ "Passed", "BackoffMs" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadBalancerStatsRequest), global::Grpc.Testing.LoadBalancerStatsRequest.Parser, new[]{ "NumRpcs", "TimeoutSec" }, null, null, null, null),
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadBalancerStatsResponse), global::Grpc.Testing.LoadBalancerStatsResponse.Parser, new[]{ "RpcsByPeer", "NumFailures" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, })
new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadBalancerStatsResponse), global::Grpc.Testing.LoadBalancerStatsResponse.Parser, new[]{ "RpcsByPeer", "NumFailures", "RpcsByMethod" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Grpc.Testing.LoadBalancerStatsResponse.Types.RpcsByPeer), global::Grpc.Testing.LoadBalancerStatsResponse.Types.RpcsByPeer.Parser, new[]{ "RpcsByPeer_" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }),
null, null, })
}));
}
#endregion
@ -2706,6 +2715,7 @@ namespace Grpc.Testing {
public LoadBalancerStatsResponse(LoadBalancerStatsResponse other) : this() {
rpcsByPeer_ = other.rpcsByPeer_.Clone();
numFailures_ = other.numFailures_;
rpcsByMethod_ = other.rpcsByMethod_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
@ -2741,6 +2751,16 @@ namespace Grpc.Testing {
}
}
/// <summary>Field number for the "rpcs_by_method" field.</summary>
public const int RpcsByMethodFieldNumber = 3;
private static readonly pbc::MapField<string, global::Grpc.Testing.LoadBalancerStatsResponse.Types.RpcsByPeer>.Codec _map_rpcsByMethod_codec
= new pbc::MapField<string, global::Grpc.Testing.LoadBalancerStatsResponse.Types.RpcsByPeer>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Grpc.Testing.LoadBalancerStatsResponse.Types.RpcsByPeer.Parser), 26);
private readonly pbc::MapField<string, global::Grpc.Testing.LoadBalancerStatsResponse.Types.RpcsByPeer> rpcsByMethod_ = new pbc::MapField<string, global::Grpc.Testing.LoadBalancerStatsResponse.Types.RpcsByPeer>();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::MapField<string, global::Grpc.Testing.LoadBalancerStatsResponse.Types.RpcsByPeer> RpcsByMethod {
get { return rpcsByMethod_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as LoadBalancerStatsResponse);
@ -2756,6 +2776,7 @@ namespace Grpc.Testing {
}
if (!RpcsByPeer.Equals(other.RpcsByPeer)) return false;
if (NumFailures != other.NumFailures) return false;
if (!RpcsByMethod.Equals(other.RpcsByMethod)) return false;
return Equals(_unknownFields, other._unknownFields);
}
@ -2764,6 +2785,7 @@ namespace Grpc.Testing {
int hash = 1;
hash ^= RpcsByPeer.GetHashCode();
if (NumFailures != 0) hash ^= NumFailures.GetHashCode();
hash ^= RpcsByMethod.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
@ -2782,6 +2804,7 @@ namespace Grpc.Testing {
output.WriteRawTag(16);
output.WriteInt32(NumFailures);
}
rpcsByMethod_.WriteTo(output, _map_rpcsByMethod_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
@ -2794,6 +2817,7 @@ namespace Grpc.Testing {
if (NumFailures != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(NumFailures);
}
size += rpcsByMethod_.CalculateSize(_map_rpcsByMethod_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
@ -2809,6 +2833,7 @@ namespace Grpc.Testing {
if (other.NumFailures != 0) {
NumFailures = other.NumFailures;
}
rpcsByMethod_.Add(other.rpcsByMethod_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
@ -2828,9 +2853,144 @@ namespace Grpc.Testing {
NumFailures = input.ReadInt32();
break;
}
case 26: {
rpcsByMethod_.AddEntriesFrom(input, _map_rpcsByMethod_codec);
break;
}
}
}
}
#region Nested types
/// <summary>Container for nested types declared in the LoadBalancerStatsResponse message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static partial class Types {
public sealed partial class RpcsByPeer : pb::IMessage<RpcsByPeer> {
private static readonly pb::MessageParser<RpcsByPeer> _parser = new pb::MessageParser<RpcsByPeer>(() => new RpcsByPeer());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pb::MessageParser<RpcsByPeer> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public static pbr::MessageDescriptor Descriptor {
get { return global::Grpc.Testing.LoadBalancerStatsResponse.Descriptor.NestedTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public RpcsByPeer() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public RpcsByPeer(RpcsByPeer other) : this() {
rpcsByPeer_ = other.rpcsByPeer_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public RpcsByPeer Clone() {
return new RpcsByPeer(this);
}
/// <summary>Field number for the "rpcs_by_peer" field.</summary>
public const int RpcsByPeer_FieldNumber = 1;
private static readonly pbc::MapField<string, int>.Codec _map_rpcsByPeer_codec
= new pbc::MapField<string, int>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForInt32(16, 0), 10);
private readonly pbc::MapField<string, int> rpcsByPeer_ = new pbc::MapField<string, int>();
/// <summary>
/// The number of completed RPCs for each peer.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public pbc::MapField<string, int> RpcsByPeer_ {
get { return rpcsByPeer_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override bool Equals(object other) {
return Equals(other as RpcsByPeer);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public bool Equals(RpcsByPeer other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (!RpcsByPeer_.Equals(other.RpcsByPeer_)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override int GetHashCode() {
int hash = 1;
hash ^= RpcsByPeer_.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void WriteTo(pb::CodedOutputStream output) {
rpcsByPeer_.WriteTo(output, _map_rpcsByPeer_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public int CalculateSize() {
int size = 0;
size += rpcsByPeer_.CalculateSize(_map_rpcsByPeer_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(RpcsByPeer other) {
if (other == null) {
return;
}
rpcsByPeer_.Add(other.rpcsByPeer_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
public void MergeFrom(pb::CodedInputStream input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
rpcsByPeer_.AddEntriesFrom(input, _map_rpcsByPeer_codec);
break;
}
}
}
}
}
}
#endregion
}

@ -50,7 +50,10 @@ namespace Grpc.Testing {
"RW1wdHkaGy5ncnBjLnRlc3RpbmcuUmVjb25uZWN0SW5mbzJ/ChhMb2FkQmFs",
"YW5jZXJTdGF0c1NlcnZpY2USYwoOR2V0Q2xpZW50U3RhdHMSJi5ncnBjLnRl",
"c3RpbmcuTG9hZEJhbGFuY2VyU3RhdHNSZXF1ZXN0GicuZ3JwYy50ZXN0aW5n",
"LkxvYWRCYWxhbmNlclN0YXRzUmVzcG9uc2UiAGIGcHJvdG8z"));
"LkxvYWRCYWxhbmNlclN0YXRzUmVzcG9uc2UiADKLAQoWWGRzVXBkYXRlSGVh",
"bHRoU2VydmljZRI2CgpTZXRTZXJ2aW5nEhMuZ3JwYy50ZXN0aW5nLkVtcHR5",
"GhMuZ3JwYy50ZXN0aW5nLkVtcHR5EjkKDVNldE5vdFNlcnZpbmcSEy5ncnBj",
"LnRlc3RpbmcuRW1wdHkaEy5ncnBjLnRlc3RpbmcuRW1wdHliBnByb3RvMw=="));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Grpc.Testing.EmptyReflection.Descriptor, global::Grpc.Testing.MessagesReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, null));

@ -950,5 +950,132 @@ namespace Grpc.Testing {
}
}
/// <summary>
/// A service to remotely control health status of an xDS test server.
/// </summary>
public static partial class XdsUpdateHealthService
{
static readonly string __ServiceName = "grpc.testing.XdsUpdateHealthService";
static readonly grpc::Marshaller<global::Grpc.Testing.Empty> __Marshaller_grpc_testing_Empty = grpc::Marshallers.Create((arg) => global::Google.Protobuf.MessageExtensions.ToByteArray(arg), global::Grpc.Testing.Empty.Parser.ParseFrom);
static readonly grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty> __Method_SetServing = new grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"SetServing",
__Marshaller_grpc_testing_Empty,
__Marshaller_grpc_testing_Empty);
static readonly grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty> __Method_SetNotServing = new grpc::Method<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>(
grpc::MethodType.Unary,
__ServiceName,
"SetNotServing",
__Marshaller_grpc_testing_Empty,
__Marshaller_grpc_testing_Empty);
/// <summary>Service descriptor</summary>
public static global::Google.Protobuf.Reflection.ServiceDescriptor Descriptor
{
get { return global::Grpc.Testing.TestReflection.Descriptor.Services[4]; }
}
/// <summary>Base class for server-side implementations of XdsUpdateHealthService</summary>
[grpc::BindServiceMethod(typeof(XdsUpdateHealthService), "BindService")]
public abstract partial class XdsUpdateHealthServiceBase
{
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> SetServing(global::Grpc.Testing.Empty request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
public virtual global::System.Threading.Tasks.Task<global::Grpc.Testing.Empty> SetNotServing(global::Grpc.Testing.Empty request, grpc::ServerCallContext context)
{
throw new grpc::RpcException(new grpc::Status(grpc::StatusCode.Unimplemented, ""));
}
}
/// <summary>Client for XdsUpdateHealthService</summary>
public partial class XdsUpdateHealthServiceClient : grpc::ClientBase<XdsUpdateHealthServiceClient>
{
/// <summary>Creates a new client for XdsUpdateHealthService</summary>
/// <param name="channel">The channel to use to make remote calls.</param>
public XdsUpdateHealthServiceClient(grpc::ChannelBase channel) : base(channel)
{
}
/// <summary>Creates a new client for XdsUpdateHealthService that uses a custom <c>CallInvoker</c>.</summary>
/// <param name="callInvoker">The callInvoker to use to make remote calls.</param>
public XdsUpdateHealthServiceClient(grpc::CallInvoker callInvoker) : base(callInvoker)
{
}
/// <summary>Protected parameterless constructor to allow creation of test doubles.</summary>
protected XdsUpdateHealthServiceClient() : base()
{
}
/// <summary>Protected constructor to allow creation of configured clients.</summary>
/// <param name="configuration">The client configuration.</param>
protected XdsUpdateHealthServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
}
public virtual global::Grpc.Testing.Empty SetServing(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SetServing(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Grpc.Testing.Empty SetServing(global::Grpc.Testing.Empty request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_SetServing, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Empty> SetServingAsync(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SetServingAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Empty> SetServingAsync(global::Grpc.Testing.Empty request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_SetServing, null, options, request);
}
public virtual global::Grpc.Testing.Empty SetNotServing(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SetNotServing(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual global::Grpc.Testing.Empty SetNotServing(global::Grpc.Testing.Empty request, grpc::CallOptions options)
{
return CallInvoker.BlockingUnaryCall(__Method_SetNotServing, null, options, request);
}
public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Empty> SetNotServingAsync(global::Grpc.Testing.Empty request, grpc::Metadata headers = null, global::System.DateTime? deadline = null, global::System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
return SetNotServingAsync(request, new grpc::CallOptions(headers, deadline, cancellationToken));
}
public virtual grpc::AsyncUnaryCall<global::Grpc.Testing.Empty> SetNotServingAsync(global::Grpc.Testing.Empty request, grpc::CallOptions options)
{
return CallInvoker.AsyncUnaryCall(__Method_SetNotServing, null, options, request);
}
/// <summary>Creates a new instance of client from given <c>ClientBaseConfiguration</c>.</summary>
protected override XdsUpdateHealthServiceClient NewInstance(ClientBaseConfiguration configuration)
{
return new XdsUpdateHealthServiceClient(configuration);
}
}
/// <summary>Creates service definition that can be registered with a server</summary>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static grpc::ServerServiceDefinition BindService(XdsUpdateHealthServiceBase serviceImpl)
{
return grpc::ServerServiceDefinition.CreateBuilder()
.AddMethod(__Method_SetServing, serviceImpl.SetServing)
.AddMethod(__Method_SetNotServing, serviceImpl.SetNotServing).Build();
}
/// <summary>Register service method with a service binder with or without implementation. Useful when customizing the service binding logic.
/// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
/// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
/// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
public static void BindService(grpc::ServiceBinderBase serviceBinder, XdsUpdateHealthServiceBase serviceImpl)
{
serviceBinder.AddMethod(__Method_SetServing, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>(serviceImpl.SetServing));
serviceBinder.AddMethod(__Method_SetNotServing, serviceImpl == null ? null : new grpc::UnaryServerMethod<global::Grpc.Testing.Empty, global::Grpc.Testing.Empty>(serviceImpl.SetNotServing));
}
}
}
#endregion

@ -39,7 +39,7 @@ namespace Grpc.IntegrationTesting
[Option("qps", Default = 1)]
// The desired QPS per channel.
// The desired QPS per channel, for each type of RPC.
public int Qps { get; set; }
[Option("server", Default = "localhost:8080")]
@ -53,18 +53,37 @@ namespace Grpc.IntegrationTesting
[Option("print_response", Default = false)]
public bool PrintResponse { get; set; }
// Types of RPCs to make, ',' separated string. RPCs can be EmptyCall or UnaryCall
[Option("rpc", Default = "UnaryCall")]
public string Rpc { get; set; }
// The metadata to send with each RPC, in the format EmptyCall:key1:value1,UnaryCall:key2:value2
[Option("metadata", Default = null)]
public string Metadata { get; set; }
}
internal enum RpcType
{
UnaryCall,
EmptyCall
}
ClientOptions options;
StatsWatcher statsWatcher = new StatsWatcher();
List<RpcType> rpcs;
Dictionary<RpcType, Metadata> metadata;
// make watcher accessible by tests
internal StatsWatcher StatsWatcher => statsWatcher;
internal XdsInteropClient(ClientOptions options)
{
this.options = options;
this.rpcs = ParseRpcArgument(this.options.Rpc);
this.metadata = ParseMetadataArgument(this.options.Metadata);
}
public static void Run(string[] args)
@ -124,8 +143,11 @@ namespace Grpc.IntegrationTesting
var stopwatch = Stopwatch.StartNew();
while (!cancellationToken.IsCancellationRequested)
{
inflightTasks.Add(RunSingleRpcAsync(client, cancellationToken));
rpcsStarted++;
foreach (var rpcType in rpcs)
{
inflightTasks.Add(RunSingleRpcAsync(client, cancellationToken, rpcType));
rpcsStarted++;
}
// only cleanup calls that have already completed, calls that are still inflight will be cleaned up later.
await CleanupCompletedTasksAsync(inflightTasks);
@ -133,7 +155,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine($"Currently {inflightTasks.Count} in-flight RPCs");
// if needed, wait a bit before we start the next RPC.
int nextDueInMillis = (int) Math.Max(0, (1000 * rpcsStarted / options.Qps) - stopwatch.ElapsedMilliseconds);
int nextDueInMillis = (int) Math.Max(0, (1000 * rpcsStarted / options.Qps / rpcs.Count) - stopwatch.ElapsedMilliseconds);
if (nextDueInMillis > 0)
{
await Task.Delay(nextDueInMillis);
@ -146,25 +168,61 @@ namespace Grpc.IntegrationTesting
Console.WriteLine($"Channel shutdown {channelId}");
}
private async Task RunSingleRpcAsync(TestService.TestServiceClient client, CancellationToken cancellationToken)
private async Task RunSingleRpcAsync(TestService.TestServiceClient client, CancellationToken cancellationToken, RpcType rpcType)
{
long rpcId = statsWatcher.RpcIdGenerator.Increment();
try
{
Console.WriteLine($"Starting RPC {rpcId}.");
var response = await client.UnaryCallAsync(new SimpleRequest(),
new CallOptions(cancellationToken: cancellationToken, deadline: DateTime.UtcNow.AddSeconds(options.RpcTimeoutSec)));
statsWatcher.OnRpcComplete(rpcId, response.Hostname);
if (options.PrintResponse)
Console.WriteLine($"Starting RPC {rpcId} of type {rpcType}");
// metadata to send with the RPC
var headers = new Metadata();
if (metadata.ContainsKey(rpcType))
{
Console.WriteLine($"Got response {response}");
headers = metadata[rpcType];
if (headers.Count > 0)
{
var printableHeaders = "[" + string.Join(", ", headers) + "]";
Console.WriteLine($"Will send metadata {printableHeaders}");
}
}
Console.WriteLine($"RPC {rpcId} succeeded ");
if (rpcType == RpcType.UnaryCall)
{
var call = client.UnaryCallAsync(new SimpleRequest(),
new CallOptions(headers: headers, cancellationToken: cancellationToken, deadline: DateTime.UtcNow.AddSeconds(options.RpcTimeoutSec)));
var response = await call;
var hostname = (await call.ResponseHeadersAsync).GetValue("hostname") ?? response.Hostname;
statsWatcher.OnRpcComplete(rpcId, rpcType, hostname);
if (options.PrintResponse)
{
Console.WriteLine($"Got response {response}");
}
}
else if (rpcType == RpcType.EmptyCall)
{
var call = client.EmptyCallAsync(new Empty(),
new CallOptions(headers: headers, cancellationToken: cancellationToken, deadline: DateTime.UtcNow.AddSeconds(options.RpcTimeoutSec)));
var response = await call;
var hostname = (await call.ResponseHeadersAsync).GetValue("hostname");
statsWatcher.OnRpcComplete(rpcId, rpcType, hostname);
if (options.PrintResponse)
{
Console.WriteLine($"Got response {response}");
}
}
else
{
throw new InvalidOperationException($"Unsupported RPC type ${rpcType}");
}
Console.WriteLine($"RPC {rpcId} succeeded");
}
catch (RpcException ex)
{
statsWatcher.OnRpcComplete(rpcId, null);
statsWatcher.OnRpcComplete(rpcId, rpcType, null);
Console.WriteLine($"RPC {rpcId} failed: {ex}");
}
}
@ -186,6 +244,66 @@ namespace Grpc.IntegrationTesting
tasks.Remove(task);
}
}
private static List<RpcType> ParseRpcArgument(string rpcArg)
{
var result = new List<RpcType>();
foreach (var part in rpcArg.Split(','))
{
result.Add(ParseRpc(part));
}
return result;
}
private static RpcType ParseRpc(string rpc)
{
switch (rpc)
{
case "UnaryCall":
return RpcType.UnaryCall;
case "EmptyCall":
return RpcType.EmptyCall;
default:
throw new ArgumentException($"Unknown RPC: \"{rpc}\"");
}
}
private static Dictionary<RpcType, Metadata> ParseMetadataArgument(string metadataArg)
{
var rpcMetadata = new Dictionary<RpcType, Metadata>();
if (string.IsNullOrEmpty(metadataArg))
{
return rpcMetadata;
}
foreach (var metadata in metadataArg.Split(','))
{
var parts = metadata.Split(':');
if (parts.Length != 3)
{
throw new ArgumentException($"Invalid metadata: \"{metadata}\"");
}
var rpc = ParseRpc(parts[0]);
var key = parts[1];
var value = parts[2];
var md = new Metadata { {key, value} };
if (rpcMetadata.ContainsKey(rpc))
{
var existingMetadata = rpcMetadata[rpc];
foreach (var entry in md)
{
existingMetadata.Add(entry);
}
}
else
{
rpcMetadata.Add(rpc, md);
}
}
return rpcMetadata;
}
}
internal class StatsWatcher
@ -198,6 +316,7 @@ namespace Grpc.IntegrationTesting
private int rpcsCompleted;
private int rpcsNoHostname;
private Dictionary<string, int> rpcsByHostname;
private Dictionary<string, Dictionary<string, int>> rpcsByMethod;
public AtomicCounter RpcIdGenerator => rpcIdGenerator;
@ -206,7 +325,7 @@ namespace Grpc.IntegrationTesting
Reset();
}
public void OnRpcComplete(long rpcId, string responseHostname)
public void OnRpcComplete(long rpcId, XdsInteropClient.RpcType rpcType, string responseHostname)
{
lock (myLock)
{
@ -221,11 +340,24 @@ namespace Grpc.IntegrationTesting
}
else
{
// update rpcsByHostname
if (!rpcsByHostname.ContainsKey(responseHostname))
{
rpcsByHostname[responseHostname] = 0;
}
rpcsByHostname[responseHostname] += 1;
// update rpcsByMethod
var method = rpcType.ToString();
if (!rpcsByMethod.ContainsKey(method))
{
rpcsByMethod[method] = new Dictionary<string, int>();
}
if (!rpcsByMethod[method].ContainsKey(responseHostname))
{
rpcsByMethod[method][responseHostname] = 0;
}
rpcsByMethod[method][responseHostname] += 1;
}
rpcsCompleted += 1;
@ -245,6 +377,7 @@ namespace Grpc.IntegrationTesting
rpcsCompleted = 0;
rpcsNoHostname = 0;
rpcsByHostname = new Dictionary<string, int>();
rpcsByMethod = new Dictionary<string, Dictionary<string, int>>();
}
}
@ -269,6 +402,14 @@ namespace Grpc.IntegrationTesting
// we collected enough RPCs, or timed out waiting
var response = new LoadBalancerStatsResponse { NumFailures = rpcsNoHostname };
response.RpcsByPeer.Add(rpcsByHostname);
response.RpcsByMethod.Clear();
foreach (var methodEntry in rpcsByMethod)
{
var rpcsByPeer = new LoadBalancerStatsResponse.Types.RpcsByPeer();
rpcsByPeer.RpcsByPeer_.Add(methodEntry.Value);
response.RpcsByMethod[methodEntry.Key] = rpcsByPeer;
}
Reset();
return response;
}

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

Loading…
Cancel
Save