Merge remote-tracking branch 'upstream/master' into isolate-call-implementation-2

pull/19704/head
Muxi Yan 5 years ago
commit f006badc32
  1. 1
      .clang_complete
  2. 2
      .github/CODEOWNERS
  3. 33
      .github/ISSUE_TEMPLATE/bug_report.md
  4. 18
      .github/ISSUE_TEMPLATE/cleanup_request.md
  5. 29
      .github/ISSUE_TEMPLATE/feature_request.md
  6. 11
      .github/pull_request_template.md
  7. 7
      .gitignore
  8. 13
      BUILD
  9. 28
      BUILD.gn
  10. 8
      BUILDING.md
  11. 630
      CMakeLists.txt
  12. 295
      Makefile
  13. 1
      PYTHON-MANIFEST.in
  14. 4
      bazel/OWNERS
  15. 36
      bazel/grpc_build_system.bzl
  16. 21
      bazel/grpc_deps.bzl
  17. 1
      bazel/objc_grpc_library.bzl
  18. 1006
      build.yaml
  19. 3
      config.m4
  20. 3
      config.w32
  21. 4
      doc/keepalive.md
  22. 38
      doc/statuscodes.md
  23. 5
      examples/BUILD
  24. 119
      examples/objective-c/BUILD
  25. 4
      examples/objective-c/helloworld/main.m
  26. 2
      examples/objective-c/helloworld_macos/HelloWorld/Info.plist
  27. 4
      examples/objective-c/helloworld_macos/main.m
  28. 4
      examples/objective-c/route_guide/ViewControllers.m
  29. 366
      gRPC-C++.podspec
  30. 3
      gRPC-Core.podspec
  31. 1
      grpc.gemspec
  32. 12
      grpc.gyp
  33. 11
      include/grpc/impl/codegen/grpc_types.h
  34. 2
      include/grpcpp/impl/codegen/client_context_impl.h
  35. 7
      include/grpcpp/impl/codegen/proto_utils.h
  36. 1
      package.xml
  37. 2
      setup.py
  38. 5
      src/benchmark/gen_build_yaml.py
  39. 11
      src/boringssl/gen_build_yaml.py
  40. 2
      src/c-ares/gen_build_yaml.py
  41. 14
      src/compiler/ruby_generator.cc
  42. 23
      src/compiler/ruby_generator_string-inl.h
  43. 5
      src/core/ext/filters/client_channel/client_channel.cc
  44. 3
      src/core/ext/filters/client_channel/health/health_check_client.cc
  45. 170
      src/core/ext/filters/client_channel/lb_policy/xds/xds.cc
  46. 2
      src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h
  47. 21
      src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.cc
  48. 89
      src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc
  49. 236
      src/core/ext/filters/client_idle/client_idle_filter.cc
  50. 18
      src/core/ext/filters/http/client/http_client_filter.cc
  51. 2
      src/core/ext/filters/http/client_authority_filter.cc
  52. 17
      src/core/ext/filters/http/message_compress/message_compress_filter.cc
  53. 78
      src/core/ext/filters/http/server/http_server_filter.cc
  54. 81
      src/core/ext/transport/chttp2/transport/chttp2_transport.cc
  55. 1
      src/core/ext/transport/chttp2/transport/frame_ping.cc
  56. 8
      src/core/ext/transport/chttp2/transport/frame_rst_stream.cc
  57. 7
      src/core/ext/transport/chttp2/transport/frame_rst_stream.h
  58. 1
      src/core/ext/transport/chttp2/transport/frame_settings.cc
  59. 5
      src/core/ext/transport/chttp2/transport/hpack_parser.cc
  60. 7
      src/core/ext/transport/chttp2/transport/internal.h
  61. 14
      src/core/ext/transport/chttp2/transport/parsing.cc
  62. 1
      src/core/ext/transport/chttp2/transport/writing.cc
  63. 31
      src/core/ext/transport/cronet/transport/cronet_transport.cc
  64. 19
      src/core/lib/channel/channel_args.cc
  65. 18
      src/core/lib/channel/channel_args.h
  66. 17
      src/core/lib/gprpp/map.h
  67. 9
      src/core/lib/iomgr/timer_manager.cc
  68. 2
      src/core/lib/iomgr/timer_manager.h
  69. 12
      src/core/lib/surface/call.cc
  70. 11
      src/core/lib/surface/server.cc
  71. 88
      src/core/lib/transport/metadata_batch.cc
  72. 38
      src/core/lib/transport/metadata_batch.h
  73. 4
      src/core/plugin_registry/grpc_plugin_registry.cc
  74. 4
      src/core/plugin_registry/grpc_unsecure_plugin_registry.cc
  75. 6
      src/cpp/ext/filters/census/client_filter.cc
  76. 7
      src/cpp/ext/filters/census/server_filter.cc
  77. 12
      src/objective-c/!ProtoCompiler-gRPCCppPlugin.podspec
  78. 12
      src/objective-c/!ProtoCompiler-gRPCPlugin.podspec
  79. 17
      src/objective-c/!ProtoCompiler.podspec
  80. 59
      src/objective-c/BUILD
  81. 1
      src/objective-c/GRPCClient/private/GRPCCore/GRPCOpBatchLog.h
  82. 161
      src/objective-c/examples/BUILD
  83. 31
      src/objective-c/examples/BazelBuildSamples/ios-sample/Podfile
  84. 413
      src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample.xcodeproj/project.pbxproj
  85. 63
      src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/AppDelegate.m
  86. 98
      src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/AppIcon.appiconset/Contents.json
  87. 6
      src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/Contents.json
  88. 25
      src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/LaunchScreen.storyboard
  89. 38
      src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/Base.lproj/Main.storyboard
  90. 86
      src/objective-c/examples/BazelBuildSamples/ios-sample/ios-sample/ViewController.m
  91. 118
      src/objective-c/examples/BazelBuildSamples/messages.proto
  92. 57
      src/objective-c/examples/BazelBuildSamples/rmt/test.proto
  93. 2
      src/objective-c/examples/InterceptorSample/InterceptorSample/Info.plist
  94. 6
      src/objective-c/examples/RemoteTestClient/RemoteTest.podspec
  95. 4
      src/objective-c/examples/Sample/Sample.xcodeproj/project.pbxproj
  96. 2
      src/objective-c/examples/Sample/Sample/Info.plist
  97. 2
      src/objective-c/examples/SwiftSample/SwiftSample.xcodeproj/project.pbxproj
  98. 8
      src/objective-c/examples/tvOS-sample/tvOS-sample.xcodeproj/project.pbxproj
  99. 2
      src/objective-c/examples/tvOS-sample/tvOS-sample/Info.plist
  100. 21
      src/objective-c/examples/watchOS-sample/WatchKit-App/Assets.xcassets/AppIcon.appiconset/Contents.json
  101. Some files were not shown because too many files have changed in this diff Show More

@ -13,7 +13,6 @@
-Ithird_party/googletest/googlemock/include
-Ithird_party/googletest/googletest/include
-Ithird_party/googletest/include
-Ithird_party/nanopb
-Ithird_party/protobuf/src
-Ithird_party/upb
-Ithird_party/zlib

@ -2,7 +2,7 @@
# Uses OWNERS files in different modules throughout the
# repository as the source of truth for module ownership.
/**/OWNERS @markdroth @nicolasnoble @a11r
/bazel/** @nicolasnoble @jtattermusch @a11r @vjpai
/bazel/** @nicolasnoble @jtattermusch @veblush @gnossen
/cmake/** @jtattermusch @nicolasnoble @apolcyn
/src/core/ext/filters/client_channel/** @markdroth @apolcyn @AspirinSJL
/tools/dockerfile/** @jtattermusch @apolcyn @nicolasnoble

@ -1,3 +1,11 @@
---
name: Report a bug
about: Create a report to help us improve
labels: kind/bug, priority/P2
assignees: AspirinSJL
---
<!--
This form is for bug reports and feature requests ONLY!
@ -7,27 +15,26 @@ For general questions and troubleshooting, please ask/look for answers here:
Issues specific to *grpc-java*, *grpc-go*, *grpc-node*, *grpc-dart*, *grpc-web* should be created in the repository they belong to (e.g. https://github.com/grpc/grpc-LANGUAGE/issues/new)
-->
### What version of gRPC and what language are you using?
### What operating system (Linux, Windows,...) and version?
### What runtime / compiler are you using (e.g. python version or version of gcc)
### What did you do?
If possible, provide a recipe for reproducing the error. Try being specific and include code snippets if helpful.
### What did you expect to see?
### What did you see instead?
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
See [TROUBLESHOOTING.md](https://github.com/grpc/grpc/blob/master/TROUBLESHOOTING.md) for how to diagnose problems better.
### Anything else we should know about your project / environment?
### Anything else we should know about your project / environment?

@ -0,0 +1,18 @@
---
name: Request a cleanup
about: Suggest a cleanup in our repository
labels: kind/internal cleanup
assignees: AspirinSJL
---
<!--
This form is for bug reports and feature requests ONLY!
For general questions and troubleshooting, please ask/look for answers here:
- grpc.io mailing list: https://groups.google.com/forum/#!forum/grpc-io
- StackOverflow, with "grpc" tag: https://stackoverflow.com/questions/tagged/grpc
Issues specific to *grpc-java*, *grpc-go*, *grpc-node*, *grpc-dart*, *grpc-web* should be created in the repository they belong to (e.g. https://github.com/grpc/grpc-LANGUAGE/issues/new)
-->

@ -0,0 +1,29 @@
---
name: Request a feature
about: Suggest an idea for this project
labels: kind/enhancement
assignees: AspirinSJL
---
<!--
This form is for bug reports and feature requests ONLY!
For general questions and troubleshooting, please ask/look for answers here:
- grpc.io mailing list: https://groups.google.com/forum/#!forum/grpc-io
- StackOverflow, with "grpc" tag: https://stackoverflow.com/questions/tagged/grpc
Issues specific to *grpc-java*, *grpc-go*, *grpc-node*, *grpc-dart*, *grpc-web* should be created in the repository they belong to (e.g. https://github.com/grpc/grpc-LANGUAGE/issues/new)
-->
### Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
### Describe the solution you'd like
A clear and concise description of what you want to happen.
### Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
### Additional context
Add any other context about the feature request here.

@ -0,0 +1,11 @@
<!--
Your pull request will be routed to the following person by default for triaging.
If you know who should review your pull request, please remove the mentioning below.
-->
@AspirinSJL

7
.gitignore vendored

@ -94,6 +94,7 @@ DerivedData
# Objective-C generated files
*.pbobjc.*
*.pbrpc.*
src/objective-c/**/Build
# Cocoapods artifacts
Pods/
@ -139,13 +140,9 @@ bm_*.json
# Visual Studio Code artifacts
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
# Clion artifacts
cmake-build-debug/
# Benchmark outputs
BenchmarkDotNet.Artifacts/
BenchmarkDotNet.Artifacts/

13
BUILD

@ -991,6 +991,7 @@ grpc_cc_library(
"grpc_resolver_fake",
"grpc_resolver_dns_native",
"grpc_resolver_sockaddr",
"grpc_resolver_xds",
"grpc_transport_chttp2_client_insecure",
"grpc_transport_chttp2_server_insecure",
"grpc_transport_inproc",
@ -1527,6 +1528,18 @@ grpc_cc_library(
],
)
grpc_cc_library(
name = "grpc_resolver_xds",
srcs = [
"src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc",
],
language = "c++",
deps = [
"grpc_base",
"grpc_client_channel",
],
)
grpc_cc_library(
name = "grpc_secure",
srcs = [

@ -31,29 +31,6 @@ config("grpc_config") {
]
}
source_set("nanopb") {
sources = [
"third_party/nanopb/pb.h",
"third_party/nanopb/pb_common.c",
"third_party/nanopb/pb_common.h",
"third_party/nanopb/pb_decode.c",
"third_party/nanopb/pb_decode.h",
"third_party/nanopb/pb_encode.c",
"third_party/nanopb/pb_encode.h",
]
deps = [
]
public_configs = [
":grpc_config",
]
include_dirs = [
"third_party/nanopb",
]
}
source_set("address_sorting") {
@ -305,6 +282,7 @@ config("grpc_config") {
"src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc",
"src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h",
"src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc",
"src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc",
"src/core/ext/filters/client_channel/resolver_factory.h",
"src/core/ext/filters/client_channel/resolver_registry.cc",
"src/core/ext/filters/client_channel/resolver_registry.h",
@ -938,7 +916,6 @@ config("grpc_config") {
include_dirs = [
"third_party/cares",
"third_party/address_sorting/include",
"third_party/nanopb",
]
}
@ -1465,9 +1442,6 @@ config("grpc_config") {
public_configs = [
":grpc_config",
]
include_dirs = [
"third_party/nanopb",
]
}
# Only compile the plugin for the host architecture.

@ -14,6 +14,7 @@ If you plan to build from source and run tests, install the following as well:
$ [sudo] apt-get install libgflags-dev libgtest-dev
$ [sudo] apt-get install clang libc++-dev
```
Lastly, see the Protoc section below if you do not yet have the protoc compiler installed.
## MacOS
@ -46,6 +47,7 @@ installed by `brew` is being used:
```sh
$ LIBTOOL=glibtool LIBTOOLIZE=glibtoolize make
```
Lastly, see the Protoc section below if you do not yet have the protoc compiler.
## Windows
@ -112,6 +114,12 @@ From the grpc repository root
```sh
$ make
```
NOTE: if you get an error on linux such as 'aclocal-1.15: command not found', which can happen if you ran 'make' before installing the pre-reqs, try the following:
```sh
$ git clean -f -d -x && git submodule foreach --recursive git clean -f -d -x
$ [sudo] apt-get install build-essential autoconf libtool pkg-config
$ make
```
## bazel

File diff suppressed because it is too large Load Diff

@ -330,6 +330,12 @@ ifeq ($(HAS_WORKING_NO_MAYBE_UNINITIALIZED),true)
W_NO_MAYBE_UNINITIALIZED=-Wno-maybe-uninitialized
NO_W_NO_MAYBE_UNINITIALIZED=-Wmaybe-uninitialized
endif
CHECK_NO_UNKNOWN_WARNING_OPTION_WORKS_CMD = $(CC) -std=c99 -Werror -Wno-unknown-warning-option -o $(TMPOUT) -c test/build/no-unknown-warning-option.c
HAS_WORKING_NO_UNKNOWN_WARNING_OPTION = $(shell $(CHECK_NO_UNKNOWN_WARNING_OPTION_WORKS_CMD) 2> /dev/null && echo true || echo false)
ifeq ($(HAS_WORKING_NO_UNKNOWN_WARNING_OPTION),true)
W_NO_UNKNOWN_WARNING_OPTION=-Wno-unknown-warning-option
NO_W_NO_UNKNOWN_WARNING_OPTION=-Wunknown-warning-option
endif
# The HOST compiler settings are used to compile the protoc plugins.
# In most cases, you won't have to change anything, but if you are
@ -348,7 +354,7 @@ CXXFLAGS += -stdlib=libc++
LDFLAGS += -framework CoreFoundation
endif
CXXFLAGS += -Wnon-virtual-dtor
CPPFLAGS += -g -Wall -Wextra -Werror -Wno-unknown-warning-option -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/nanopb -Ithird_party/upb -Isrc/core/ext/upb-generated
CPPFLAGS += -g -Wall -Wextra -Werror $(W_NO_UNKNOWN_WARNING_OPTION) -Wno-long-long -Wno-unused-parameter -Wno-deprecated-declarations -Wno-sign-conversion -Wno-shadow -Wno-conversion -Wno-implicit-fallthrough -Wno-sign-compare -Wno-missing-field-initializers -Wno-maybe-uninitialized -DPB_FIELD_32BIT -DOSATOMIC_USE_INLINED=1 -Ithird_party/upb -Isrc/core/ext/upb-generated
COREFLAGS += -fno-rtti -fno-exceptions
LDFLAGS += -g
@ -1206,6 +1212,9 @@ end2end_test: $(BINDIR)/$(CONFIG)/end2end_test
error_details_test: $(BINDIR)/$(CONFIG)/error_details_test
exception_test: $(BINDIR)/$(CONFIG)/exception_test
filter_end2end_test: $(BINDIR)/$(CONFIG)/filter_end2end_test
gen_hpack_tables: $(BINDIR)/$(CONFIG)/gen_hpack_tables
gen_legal_metadata_characters: $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters
gen_percent_encoding_tables: $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables
generic_end2end_test: $(BINDIR)/$(CONFIG)/generic_end2end_test
global_config_env_test: $(BINDIR)/$(CONFIG)/global_config_env_test
global_config_test: $(BINDIR)/$(CONFIG)/global_config_test
@ -1284,14 +1293,12 @@ string_view_test: $(BINDIR)/$(CONFIG)/string_view_test
thread_manager_test: $(BINDIR)/$(CONFIG)/thread_manager_test
thread_stress_test: $(BINDIR)/$(CONFIG)/thread_stress_test
time_change_test: $(BINDIR)/$(CONFIG)/time_change_test
timer_test: $(BINDIR)/$(CONFIG)/timer_test
transport_pid_controller_test: $(BINDIR)/$(CONFIG)/transport_pid_controller_test
transport_security_common_api_test: $(BINDIR)/$(CONFIG)/transport_security_common_api_test
writes_per_rpc_test: $(BINDIR)/$(CONFIG)/writes_per_rpc_test
xds_end2end_test: $(BINDIR)/$(CONFIG)/xds_end2end_test
public_headers_must_be_c89: $(BINDIR)/$(CONFIG)/public_headers_must_be_c89
gen_hpack_tables: $(BINDIR)/$(CONFIG)/gen_hpack_tables
gen_legal_metadata_characters: $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters
gen_percent_encoding_tables: $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables
boringssl_ssl_test: $(BINDIR)/$(CONFIG)/boringssl_ssl_test
boringssl_crypto_test: $(BINDIR)/$(CONFIG)/boringssl_crypto_test
bad_streaming_id_bad_client_test: $(BINDIR)/$(CONFIG)/bad_streaming_id_bad_client_test
@ -1758,6 +1765,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/thread_manager_test \
$(BINDIR)/$(CONFIG)/thread_stress_test \
$(BINDIR)/$(CONFIG)/time_change_test \
$(BINDIR)/$(CONFIG)/timer_test \
$(BINDIR)/$(CONFIG)/transport_pid_controller_test \
$(BINDIR)/$(CONFIG)/transport_security_common_api_test \
$(BINDIR)/$(CONFIG)/writes_per_rpc_test \
@ -1926,6 +1934,7 @@ buildtests_cxx: privatelibs_cxx \
$(BINDIR)/$(CONFIG)/thread_manager_test \
$(BINDIR)/$(CONFIG)/thread_stress_test \
$(BINDIR)/$(CONFIG)/time_change_test \
$(BINDIR)/$(CONFIG)/timer_test \
$(BINDIR)/$(CONFIG)/transport_pid_controller_test \
$(BINDIR)/$(CONFIG)/transport_security_common_api_test \
$(BINDIR)/$(CONFIG)/writes_per_rpc_test \
@ -2381,8 +2390,6 @@ test_cxx: buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/grpclb_api_test || ( echo test grpclb_api_test failed ; exit 1 )
$(E) "[RUN] Testing grpclb_end2end_test"
$(Q) $(BINDIR)/$(CONFIG)/grpclb_end2end_test || ( echo test grpclb_end2end_test failed ; exit 1 )
$(E) "[RUN] Testing grpclb_fallback_test"
$(Q) $(BINDIR)/$(CONFIG)/grpclb_fallback_test || ( echo test grpclb_fallback_test failed ; exit 1 )
$(E) "[RUN] Testing h2_ssl_cert_test"
$(Q) $(BINDIR)/$(CONFIG)/h2_ssl_cert_test || ( echo test h2_ssl_cert_test failed ; exit 1 )
$(E) "[RUN] Testing h2_ssl_session_reuse_test"
@ -2471,6 +2478,8 @@ test_cxx: buildtests_cxx
$(Q) $(BINDIR)/$(CONFIG)/thread_stress_test || ( echo test thread_stress_test failed ; exit 1 )
$(E) "[RUN] Testing time_change_test"
$(Q) $(BINDIR)/$(CONFIG)/time_change_test || ( echo test time_change_test failed ; exit 1 )
$(E) "[RUN] Testing timer_test"
$(Q) $(BINDIR)/$(CONFIG)/timer_test || ( echo test timer_test failed ; exit 1 )
$(E) "[RUN] Testing transport_pid_controller_test"
$(Q) $(BINDIR)/$(CONFIG)/transport_pid_controller_test || ( echo test transport_pid_controller_test failed ; exit 1 )
$(E) "[RUN] Testing transport_security_common_api_test"
@ -2530,9 +2539,9 @@ test_python: static_c
tools: tools_c tools_cxx
tools_c: privatelibs_c $(BINDIR)/$(CONFIG)/check_epollexclusive $(BINDIR)/$(CONFIG)/grpc_create_jwt $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token $(BINDIR)/$(CONFIG)/grpc_verify_jwt $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables
tools_c: privatelibs_c $(BINDIR)/$(CONFIG)/check_epollexclusive $(BINDIR)/$(CONFIG)/grpc_create_jwt $(BINDIR)/$(CONFIG)/grpc_print_google_default_creds_token $(BINDIR)/$(CONFIG)/grpc_verify_jwt
tools_cxx: privatelibs_cxx
tools_cxx: privatelibs_cxx $(BINDIR)/$(CONFIG)/gen_hpack_tables $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables
buildbenchmarks: privatelibs $(BINDIR)/$(CONFIG)/low_level_ping_pong_benchmark
@ -3891,6 +3900,7 @@ LIBGRPC_SRC = \
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc \
src/core/ext/filters/census/grpc_context.cc \
src/core/ext/filters/client_idle/client_idle_filter.cc \
src/core/ext/filters/max_age/max_age_filter.cc \
@ -5255,6 +5265,7 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc \
src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc \
src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc \
src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc \
src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc \
@ -16341,6 +16352,135 @@ endif
endif
GEN_HPACK_TABLES_SRC = \
tools/codegen/core/gen_hpack_tables.cc \
GEN_HPACK_TABLES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_HPACK_TABLES_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/gen_hpack_tables: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+.
$(BINDIR)/$(CONFIG)/gen_hpack_tables: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/gen_hpack_tables: $(PROTOBUF_DEP) $(GEN_HPACK_TABLES_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(GEN_HPACK_TABLES_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_hpack_tables
endif
endif
$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_hpack_tables.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a
deps_gen_hpack_tables: $(GEN_HPACK_TABLES_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GEN_HPACK_TABLES_OBJS:.o=.dep)
endif
endif
GEN_LEGAL_METADATA_CHARACTERS_SRC = \
tools/codegen/core/gen_legal_metadata_characters.cc \
GEN_LEGAL_METADATA_CHARACTERS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_LEGAL_METADATA_CHARACTERS_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+.
$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: $(PROTOBUF_DEP) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS)
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters
endif
endif
$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_legal_metadata_characters.o:
deps_gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep)
endif
endif
GEN_PERCENT_ENCODING_TABLES_SRC = \
tools/codegen/core/gen_percent_encoding_tables.cc \
GEN_PERCENT_ENCODING_TABLES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_PERCENT_ENCODING_TABLES_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+.
$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: $(PROTOBUF_DEP) $(GEN_PERCENT_ENCODING_TABLES_OBJS)
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(GEN_PERCENT_ENCODING_TABLES_OBJS) $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables
endif
endif
$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_percent_encoding_tables.o:
deps_gen_percent_encoding_tables: $(GEN_PERCENT_ENCODING_TABLES_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GEN_PERCENT_ENCODING_TABLES_OBJS:.o=.dep)
endif
endif
GENERIC_END2END_TEST_SRC = \
test/cpp/end2end/generic_end2end_test.cc \
@ -19678,6 +19818,49 @@ endif
endif
TIMER_TEST_SRC = \
test/cpp/common/timer_test.cc \
TIMER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(TIMER_TEST_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/timer_test: openssl_dep_error
else
ifeq ($(NO_PROTOBUF),true)
# You can't build the protoc plugins or protobuf-enabled targets if you don't have protobuf 3.5.0+.
$(BINDIR)/$(CONFIG)/timer_test: protobuf_dep_error
else
$(BINDIR)/$(CONFIG)/timer_test: $(PROTOBUF_DEP) $(TIMER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LDXX) $(LDFLAGS) $(TIMER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBSXX) $(LDLIBS_PROTOBUF) $(LDLIBS) $(LDLIBS_SECURE) $(GTEST_LIB) -o $(BINDIR)/$(CONFIG)/timer_test
endif
endif
$(OBJDIR)/$(CONFIG)/test/cpp/common/timer_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc++.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_timer_test: $(TIMER_TEST_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(TIMER_TEST_OBJS:.o=.dep)
endif
endif
TRANSPORT_PID_CONTROLLER_TEST_SRC = \
test/core/transport/pid_controller_test.cc \
@ -19893,102 +20076,6 @@ endif
endif
GEN_HPACK_TABLES_SRC = \
tools/codegen/core/gen_hpack_tables.cc \
GEN_HPACK_TABLES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_HPACK_TABLES_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/gen_hpack_tables: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/gen_hpack_tables: $(GEN_HPACK_TABLES_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(GEN_HPACK_TABLES_OBJS) $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_hpack_tables
endif
$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_hpack_tables.o: $(LIBDIR)/$(CONFIG)/libgpr.a $(LIBDIR)/$(CONFIG)/libgrpc.a
deps_gen_hpack_tables: $(GEN_HPACK_TABLES_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GEN_HPACK_TABLES_OBJS:.o=.dep)
endif
endif
GEN_LEGAL_METADATA_CHARACTERS_SRC = \
tools/codegen/core/gen_legal_metadata_characters.cc \
GEN_LEGAL_METADATA_CHARACTERS_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_LEGAL_METADATA_CHARACTERS_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS)
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(GEN_LEGAL_METADATA_CHARACTERS_OBJS) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_legal_metadata_characters
endif
$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_legal_metadata_characters.o:
deps_gen_legal_metadata_characters: $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GEN_LEGAL_METADATA_CHARACTERS_OBJS:.o=.dep)
endif
endif
GEN_PERCENT_ENCODING_TABLES_SRC = \
tools/codegen/core/gen_percent_encoding_tables.cc \
GEN_PERCENT_ENCODING_TABLES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GEN_PERCENT_ENCODING_TABLES_SRC))))
ifeq ($(NO_SECURE),true)
# You can't build secure targets if you don't have OpenSSL.
$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: openssl_dep_error
else
$(BINDIR)/$(CONFIG)/gen_percent_encoding_tables: $(GEN_PERCENT_ENCODING_TABLES_OBJS)
$(E) "[LD] Linking $@"
$(Q) mkdir -p `dirname $@`
$(Q) $(LD) $(LDFLAGS) $(GEN_PERCENT_ENCODING_TABLES_OBJS) $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gen_percent_encoding_tables
endif
$(OBJDIR)/$(CONFIG)/tools/codegen/core/gen_percent_encoding_tables.o:
deps_gen_percent_encoding_tables: $(GEN_PERCENT_ENCODING_TABLES_OBJS:.o=.dep)
ifneq ($(NO_SECURE),true)
ifneq ($(NO_DEPS),true)
-include $(GEN_PERCENT_ENCODING_TABLES_OBJS:.o=.dep)
endif
endif
BORINGSSL_SSL_TEST_SRC = \
third_party/boringssl/crypto/test/gtest_main.cc \
third_party/boringssl/ssl/span_test.cc \

@ -7,7 +7,6 @@ graft include/grpc
graft third_party/address_sorting
graft third_party/boringssl
graft third_party/cares
graft third_party/nanopb
graft third_party/upb
graft third_party/zlib
include src/python/grpcio/_parallel_compile_patch.py

@ -1,6 +1,6 @@
set noparent
@nicolasnoble
@jtattermusch
@a11r
@vjpai
@veblush
@gnossen

@ -25,6 +25,8 @@
load("//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@upb//bazel:upb_proto_library.bzl", "upb_proto_library")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_unit_test")
# The set of pollers to test against if a test exercises polling
POLLERS = ["epollex", "epoll1", "poll"]
@ -136,6 +138,32 @@ def grpc_proto_library(
use_external = use_external,
generate_mocks = generate_mocks,
)
def ios_cc_test(
name,
tags = [],
**kwargs):
ios_test_adapter = "//third_party/objective_c/google_toolbox_for_mac:GTM_GoogleTestRunner_GTM_USING_XCTEST";
test_lib_ios = name + "_test_lib_ios"
ios_tags = tags + ["manual", "ios_cc_test"]
if not any([t for t in tags if t.startswith("no_test_ios")]):
native.objc_library(
name = test_lib_ios,
srcs = kwargs.get("srcs"),
deps = kwargs.get("deps"),
copts = kwargs.get("copts"),
tags = ios_tags,
alwayslink = 1,
testonly = 1,
)
ios_test_deps = [ios_test_adapter, ":" + test_lib_ios]
ios_unit_test(
name = name + "_on_ios",
size = kwargs.get("size"),
tags = ios_tags,
minimum_os_version = "9.0",
deps = ios_test_deps,
)
def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data = [], uses_polling = True, language = "C++", size = "medium", timeout = None, tags = [], exec_compatible_with = []):
copts = if_mac(["-DGRPC_CFSTREAM"])
@ -182,6 +210,12 @@ def grpc_cc_test(name, srcs = [], deps = [], external_deps = [], args = [], data
)
else:
native.cc_test(tags = tags, **args)
ios_cc_test(
name = name,
tags = tags,
**args
)
def grpc_cc_binary(name, srcs = [], deps = [], external_deps = [], args = [], data = [], language = "C++", testonly = False, linkshared = False, linkopts = [], tags = []):
copts = []
@ -207,7 +241,7 @@ def grpc_generate_one_off_targets():
actual = "//:grpc",
)
def grpc_objc_use_cronet_config():
def grpc_generate_objc_one_off_targets():
pass
def grpc_sh_test(name, srcs, args = [], data = []):

@ -8,11 +8,6 @@ load("@com_github_grpc_grpc//bazel:grpc_python_deps.bzl", "grpc_python_deps")
def grpc_deps():
"""Loads dependencies need to compile and test the grpc library."""
native.bind(
name = "nanopb",
actual = "@com_github_nanopb_nanopb//:nanopb",
)
native.bind(
name = "upb_lib",
actual = "@upb//:upb",
@ -129,15 +124,6 @@ def grpc_deps():
url = "https://github.com/google/protobuf/archive/09745575a923640154bcf307fba8aedff47f240a.tar.gz",
)
if "com_github_nanopb_nanopb" not in native.existing_rules():
http_archive(
name = "com_github_nanopb_nanopb",
build_file = "@com_github_grpc_grpc//third_party:nanopb.BUILD",
sha256 = "8bbbb1e78d4ddb0a1919276924ab10d11b631df48b657d960e0c795a25515735",
strip_prefix = "nanopb-f8ac463766281625ad710900479130c7fcb4d63b",
url = "https://github.com/nanopb/nanopb/archive/f8ac463766281625ad710900479130c7fcb4d63b.tar.gz",
)
if "com_github_google_googletest" not in native.existing_rules():
http_archive(
name = "com_github_google_googletest",
@ -191,11 +177,10 @@ def grpc_deps():
)
if "bazel_skylib" not in native.existing_rules():
http_archive(
git_repository(
name = "bazel_skylib",
sha256 = "ba5d15ca230efca96320085d8e4d58da826d1f81b444ef8afccd8b23e0799b52",
strip_prefix = "bazel-skylib-f83cb8dd6f5658bc574ccd873e25197055265d1c",
url = "https://github.com/bazelbuild/bazel-skylib/archive/f83cb8dd6f5658bc574ccd873e25197055265d1c.tar.gz",
remote = "https://github.com/bazelbuild/bazel-skylib",
tag = "0.9.0",
)
if "io_opencensus_cpp" not in native.existing_rules():

@ -64,5 +64,6 @@ def objc_grpc_library(name, deps, srcs = [], use_well_known_protos = False, **kw
"@com_github_grpc_grpc//src/objective-c:proto_objc_rpc",
"@com_google_protobuf//:protobuf_objc",
],
**kwargs
)

File diff suppressed because it is too large Load Diff

@ -10,7 +10,6 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/address_sorting/include)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/boringssl/include)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/nanopb)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/third_party/upb)
LIBS="-lpthread $LIBS"
@ -447,6 +446,7 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc \
src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc \
src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc \
src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc \
src/core/ext/filters/census/grpc_context.cc \
src/core/ext/filters/client_idle/client_idle_filter.cc \
src/core/ext/filters/max_age/max_age_filter.cc \
@ -732,6 +732,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/dns/native)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/fake)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/sockaddr)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_channel/resolver/xds)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/client_idle)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/deadline)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/filters/http)

@ -420,6 +420,7 @@ if (PHP_GRPC != "no") {
"src\\core\\ext\\filters\\client_channel\\resolver\\dns\\dns_resolver_selection.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native\\dns_resolver.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr\\sockaddr_resolver.cc " +
"src\\core\\ext\\filters\\client_channel\\resolver\\xds\\xds_resolver.cc " +
"src\\core\\ext\\filters\\census\\grpc_context.cc " +
"src\\core\\ext\\filters\\client_idle\\client_idle_filter.cc " +
"src\\core\\ext\\filters\\max_age\\max_age_filter.cc " +
@ -712,7 +713,6 @@ if (PHP_GRPC != "no") {
"/I"+configure_module_dirname+"\\src\\php\\ext\\grpc "+
"/I"+configure_module_dirname+"\\third_party\\address_sorting\\include "+
"/I"+configure_module_dirname+"\\third_party\\boringssl\\include "+
"/I"+configure_module_dirname+"\\third_party\\nanopb "+
"/I"+configure_module_dirname+"\\third_party\\upb "+
"/I"+configure_module_dirname+"\\third_party\\zlib ");
@ -738,6 +738,7 @@ if (PHP_GRPC != "no") {
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\dns\\native");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\fake");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\sockaddr");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_channel\\resolver\\xds");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\client_idle");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\deadline");
FSO.CreateFolder(base_dir+"\\ext\\grpc\\src\\core\\ext\\filters\\http");

@ -18,9 +18,9 @@ The above two channel arguments should be sufficient for most users, but the fol
* **GRPC_ARG_HTTP2_MAX_PINGS_WITHOUT_DATA**
* This channel argument controls the maximum number of pings that can be sent when there is no other data (data frame or header frame) to be sent. GRPC Core will not continue sending pings if we run over the limit. Setting it to 0 allows sending pings without sending data.
* **GRPC_ARG_HTTP2_MIN_SENT_PING_INTERVAL_WITHOUT_DATA_MS**
* If there is no data being sent on the transport, this channel argument controls the minimum time (in milliseconds) gRPC Core will wait between successive pings.
* If there are no data frames being received on the transport, this channel argument controls the minimum time (in milliseconds) gRPC Core will wait between successive pings.
* **GRPC_ARG_HTTP2_MIN_RECV_PING_INTERVAL_WITHOUT_DATA_MS**
* If there is no data being sent on the transport, this channel argument on the server side controls the minimum time (in milliseconds) that gRPC Core would expect between receiving successive pings. If the time between successive pings is less that than this time, then the ping will be considered a bad ping from the peer. Such a ping counts as a ‘ping strike’.
* If there are no data frames being sent on the transport, this channel argument on the server side controls the minimum time (in milliseconds) that gRPC Core would expect between receiving successive pings. If the time between successive pings is less that than this time, then the ping will be considered a bad ping from the peer. Such a ping counts as a ‘ping strike’.
On the client side, this does not have any effect.
* **GRPC_ARG_HTTP2_MAX_PING_STRIKES**
* This arg controls the maximum number of bad pings that the server will tolerate before sending an HTTP2 GOAWAY frame and closing the transport. Setting it to 0 allows the server to accept any number of bad pings.

@ -3,25 +3,25 @@
gRPC uses a set of well defined status codes as part of the RPC API. These
statuses are defined as such:
| Code | Number | Description | Closest HTTP Mapping |
|------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| OK | 0 | Not an error; returned on success. | 200 OK |
| CANCELLED | 1 | The operation was cancelled, typically by the caller. | 499 Client Closed Request |
| UNKNOWN | 2 | Unknown error. For example, this error may be returned when a `Status` value received from another address space belongs to an error space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error. | 500 Internal Server Error |
| INVALID_ARGUMENT | 3 | The client specified an invalid argument. Note that this differs from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name). | 400 Bad Request |
| DEADLINE_EXCEEDED | 4 | The deadline expired before the operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long | 504 Gateway Timeout |
| NOT_FOUND | 5 | Some requested entity (e.g., file or directory) was not found. Note to server developers: if a request is denied for an entire class of users, such as gradual feature rollout or undocumented whitelist, `NOT_FOUND` may be used. If a request is denied for some users within a class of users, such as user-based access control, `PERMISSION_DENIED` must be used. | 404 Not Found |
| ALREADY_EXISTS | 6 | The entity that a client attempted to create (e.g., file or directory) already exists. | 409 Conflict |
| PERMISSION_DENIED | 7 | The caller does not have permission to execute the specified operation. `PERMISSION_DENIED` must not be used for rejections caused by exhausting some resource (use `RESOURCE_EXHAUSTED` instead for those errors). `PERMISSION_DENIED` must not be used if the caller can not be identified (use `UNAUTHENTICATED` instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions. | 403 Forbidden |
| UNAUTHENTICATED | 16 | The request does not have valid authentication credentials for the operation. | 401 Unauthorized |
| RESOURCE_EXHAUSTED | 8 | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. | 429 Too Many Requests |
| FAILED_PRECONDITION | 9 | The operation was rejected because the system is not in a state required for the operation's execution. For example, the directory to be deleted is non-empty, an rmdir operation is applied to a non-directory, etc. Service implementors can use the following guidelines to decide between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: (a) Use `UNAVAILABLE` if the client can retry just the failing call. (b) Use `ABORTED` if the client should retry at a higher level (e.g., when a client-specified test-and-set fails, indicating the client should restart a read-modify-write sequence). (c) Use `FAILED_PRECONDITION` if the client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, `FAILED_PRECONDITION` should be returned since the client should not retry unless the files are deleted from the directory. | 400 Bad Request |
| ABORTED | 10 | The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort. See the guidelines above for deciding between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`. | 409 Conflict |
| OUT_OF_RANGE | 11 | The operation was attempted past the valid range. E.g., seeking or reading past end-of-file. Unlike `INVALID_ARGUMENT`, this error indicates a problem that may be fixed if the system state changes. For example, a 32-bit file system will generate `INVALID_ARGUMENT` if asked to read at an offset that is not in the range [0,2^32-1], but it will generate `OUT_OF_RANGE` if asked to read from an offset past the current file size. There is a fair bit of overlap between `FAILED_PRECONDITION` and `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific error) when it applies so that callers who are iterating through a space can easily look for an `OUT_OF_RANGE` error to detect when they are done. | 400 Bad Request |
| UNIMPLEMENTED | 12 | The operation is not implemented or is not supported/enabled in this service. | 501 Not Implemented |
| INTERNAL | 13 | Internal errors. This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors. | 500 Internal Server Error |
| UNAVAILABLE | 14 | The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations. | 503 Service Unavailable |
| DATA_LOSS | 15 | Unrecoverable data loss or corruption. | 500 Internal Server Error |
| Code | Number | Description |
|------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| OK | 0 | Not an error; returned on success. |
| CANCELLED | 1 | The operation was cancelled, typically by the caller. |
| UNKNOWN | 2 | Unknown error. For example, this error may be returned when a `Status` value received from another address space belongs to an error space that is not known in this address space. Also errors raised by APIs that do not return enough error information may be converted to this error. |
| INVALID_ARGUMENT | 3 | The client specified an invalid argument. Note that this differs from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name). |
| DEADLINE_EXCEEDED | 4 | The deadline expired before the operation could complete. For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long |
| NOT_FOUND | 5 | Some requested entity (e.g., file or directory) was not found. Note to server developers: if a request is denied for an entire class of users, such as gradual feature rollout or undocumented whitelist, `NOT_FOUND` may be used. If a request is denied for some users within a class of users, such as user-based access control, `PERMISSION_DENIED` must be used. |
| ALREADY_EXISTS | 6 | The entity that a client attempted to create (e.g., file or directory) already exists. |
| PERMISSION_DENIED | 7 | The caller does not have permission to execute the specified operation. `PERMISSION_DENIED` must not be used for rejections caused by exhausting some resource (use `RESOURCE_EXHAUSTED` instead for those errors). `PERMISSION_DENIED` must not be used if the caller can not be identified (use `UNAUTHENTICATED` instead for those errors). This error code does not imply the request is valid or the requested entity exists or satisfies other pre-conditions. |
| UNAUTHENTICATED | 16 | The request does not have valid authentication credentials for the operation. |
| RESOURCE_EXHAUSTED | 8 | Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system is out of space. |
| FAILED_PRECONDITION | 9 | The operation was rejected because the system is not in a state required for the operation's execution. For example, the directory to be deleted is non-empty, an rmdir operation is applied to a non-directory, etc. Service implementors can use the following guidelines to decide between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`: (a) Use `UNAVAILABLE` if the client can retry just the failing call. (b) Use `ABORTED` if the client should retry at a higher level (e.g., when a client-specified test-and-set fails, indicating the client should restart a read-modify-write sequence). (c) Use `FAILED_PRECONDITION` if the client should not retry until the system state has been explicitly fixed. E.g., if an "rmdir" fails because the directory is non-empty, `FAILED_PRECONDITION` should be returned since the client should not retry unless the files are deleted from the directory. |
| ABORTED | 10 | The operation was aborted, typically due to a concurrency issue such as a sequencer check failure or transaction abort. See the guidelines above for deciding between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`. |
| OUT_OF_RANGE | 11 | The operation was attempted past the valid range. E.g., seeking or reading past end-of-file. Unlike `INVALID_ARGUMENT`, this error indicates a problem that may be fixed if the system state changes. For example, a 32-bit file system will generate `INVALID_ARGUMENT` if asked to read at an offset that is not in the range [0,2^32-1], but it will generate `OUT_OF_RANGE` if asked to read from an offset past the current file size. There is a fair bit of overlap between `FAILED_PRECONDITION` and `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific error) when it applies so that callers who are iterating through a space can easily look for an `OUT_OF_RANGE` error to detect when they are done. |
| UNIMPLEMENTED | 12 | The operation is not implemented or is not supported/enabled in this service. |
| INTERNAL | 13 | Internal errors. This means that some invariants expected by the underlying system have been broken. This error code is reserved for serious errors. |
| UNAVAILABLE | 14 | The service is currently unavailable. This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations. |
| DATA_LOSS | 15 | Unrecoverable data loss or corruption. |
All RPCs started at a client return a `status` object composed of an integer
`code` and a string `message`. The server-side can choose the status it

@ -238,3 +238,8 @@ cc_binary(
"//:grpc++",
],
)
proto_library(
name = "route_guide_proto",
srcs = ["protos/route_guide.proto"],
)

@ -0,0 +1,119 @@
# Copyright 2019 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"]) # 3-clause BSD
package(default_visibility = ["//visibility:public"])
load("@com_github_grpc_grpc//bazel:objc_grpc_library.bzl", "objc_grpc_library")
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load("@build_bazel_rules_apple//apple:macos.bzl", "macos_application")
objc_grpc_library(
name = "HelloWorld_grpc_proto",
srcs = ["//examples:protos/helloworld.proto"],
deps = ["//examples:helloworld_proto"],
tags = ["manual"],
)
# This one works with import "external/com_github_grpc_grpc/examples/protos/Helloworld.pbrpc.h"
objc_grpc_library(
name = "HelloWorld_grpc_proto_external",
srcs = ["//external/com_github_grpc_grpc/examples:protos/helloworld.proto"],
deps = ["@com_github_grpc_grpc//examples:helloworld_proto"],
tags = ["manual"],
)
objc_library(
name = "HelloWorld-lib",
srcs = glob(["helloworld/**/*.m",]),
hdrs = glob(["helloworld/**/*.h"]),
data = glob([
"helloworld/HelloWorld/Base.lproj/**",
"helloworld/HelloWorld/Images.xcassets/**",
]),
includes = ["helloworld/HelloWorld"],
deps = [":HelloWorld_grpc_proto"],
tags = ["manual"],
)
ios_application(
name = "HelloWorld",
bundle_id = "Google.HelloWorld",
families = [
"iphone",
"ipad",
],
minimum_os_version = "8.0",
infoplists = ["helloworld/HelloWorld/Info.plist"],
deps = [":HelloWorld-lib"],
tags = ["manual"],
)
objc_library(
name = "HelloWorldMacos-lib",
srcs = glob(["helloworld_macos/**/*.m",]),
hdrs = glob(["helloworld_macos/**/*.h"]),
data = glob([
"helloworld_macos/HelloWorld/Base.lproj/**",
"helloworld_macos/HelloWorld/Images.xcassets/**",
]),
includes = ["helloworld_macos/HelloWorld"],
deps = [":HelloWorld_grpc_proto"],
tags = ["manual"],
)
macos_application(
name = "HelloWorldMacos",
bundle_id = "io.grpc.HelloWorld",
minimum_os_version = "10.13",
entitlements = "helloworld_macos/HelloWorld/Helloworld.entitlements",
infoplists = ["helloworld_macos/HelloWorld/Info.plist"],
deps = [":HelloWorldMacos-lib"],
tags = ["manual"],
)
objc_grpc_library(
name = "RouteGuide",
srcs = ["//examples:protos/route_guide.proto"],
deps = ["//examples:route_guide_proto"],
tags = ["manual"],
)
objc_library(
name = "RouteGuideClient-lib",
srcs = glob(["route_guide/**/*.m"]),
hdrs = glob(["route_guide/**/*.h"]),
data = glob([
"route_guide/Misc/Base.lproj/**",
"route_guide/Misc/Images.xcassets/**",
"route_guide/route_guide_db.json",
]),
includes = ["route_guide/Misc"],
deps = [":RouteGuide"],
tags = ["manual"],
)
ios_application(
name = "RouteGuideClient",
bundle_id = "gRPC.RouteGuideClient",
families = [
"iphone",
"ipad",
],
minimum_os_version = "8.0",
infoplists = ["route_guide/Misc/Info.plist"],
deps = [":RouteGuideClient-lib"],
tags = ["manual"],
)

@ -21,7 +21,11 @@
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#if COCOAPODS
#import <HelloWorld/Helloworld.pbrpc.h>
#else
#import "examples/protos/Helloworld.pbrpc.h"
#endif
static NSString * const kHostAddress = @"localhost:50051";

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>

@ -20,7 +20,11 @@
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#if COCOAPODS
#import <HelloWorld/Helloworld.pbrpc.h>
#else
#import "examples/protos/Helloworld.pbrpc.h"
#endif
static NSString * const kHostAddress = @"localhost:50051";

@ -17,7 +17,11 @@
*/
#import <UIKit/UIKit.h>
#if COCOAPODS
#import <RouteGuide/RouteGuide.pbrpc.h>
#else
#import "examples/protos/RouteGuide.pbrpc.h"
#endif
static NSString * const kHostAddress = @"localhost:50051";

@ -215,7 +215,6 @@ Pod::Spec.new do |s|
ss.header_mappings_dir = '.'
ss.dependency "#{s.name}/Interface", version
ss.dependency 'gRPC-Core', grpc_version
ss.dependency 'nanopb', '~> 0.3'
ss.source_files = 'include/grpcpp/impl/codegen/core_codegen.h',
'src/cpp/client/secure_credentials.h',
@ -228,10 +227,6 @@ Pod::Spec.new do |s|
'src/cpp/server/health/default_health_check_service.h',
'src/cpp/server/thread_pool_interface.h',
'src/cpp/thread_manager/thread_manager.h',
'third_party/nanopb/pb.h',
'third_party/nanopb/pb_common.h',
'third_party/nanopb/pb_decode.h',
'third_party/nanopb/pb_encode.h',
'src/cpp/client/insecure_credentials.cc',
'src/cpp/client/secure_credentials.cc',
'src/cpp/common/auth_property_iterator.cc',
@ -276,362 +271,7 @@ Pod::Spec.new do |s|
'src/cpp/util/string_ref.cc',
'src/cpp/util/time_cc.cc',
'src/cpp/codegen/codegen_init.cc',
'src/cpp/client/cronet_credentials.cc',
'src/core/lib/gpr/alloc.h',
'src/core/lib/gpr/arena.h',
'src/core/lib/gpr/env.h',
'src/core/lib/gpr/mpscq.h',
'src/core/lib/gpr/murmur_hash.h',
'src/core/lib/gpr/spinlock.h',
'src/core/lib/gpr/string.h',
'src/core/lib/gpr/string_windows.h',
'src/core/lib/gpr/time_precise.h',
'src/core/lib/gpr/tls.h',
'src/core/lib/gpr/tls_gcc.h',
'src/core/lib/gpr/tls_msvc.h',
'src/core/lib/gpr/tls_pthread.h',
'src/core/lib/gpr/tmpfile.h',
'src/core/lib/gpr/useful.h',
'src/core/lib/gprpp/abstract.h',
'src/core/lib/gprpp/arena.h',
'src/core/lib/gprpp/atomic.h',
'src/core/lib/gprpp/fork.h',
'src/core/lib/gprpp/global_config.h',
'src/core/lib/gprpp/global_config_custom.h',
'src/core/lib/gprpp/global_config_env.h',
'src/core/lib/gprpp/global_config_generic.h',
'src/core/lib/gprpp/host_port.h',
'src/core/lib/gprpp/manual_constructor.h',
'src/core/lib/gprpp/map.h',
'src/core/lib/gprpp/memory.h',
'src/core/lib/gprpp/pair.h',
'src/core/lib/gprpp/sync.h',
'src/core/lib/gprpp/thd.h',
'src/core/lib/profiling/timers.h',
'src/core/ext/transport/chttp2/transport/bin_decoder.h',
'src/core/ext/transport/chttp2/transport/bin_encoder.h',
'src/core/ext/transport/chttp2/transport/chttp2_transport.h',
'src/core/ext/transport/chttp2/transport/context_list.h',
'src/core/ext/transport/chttp2/transport/flow_control.h',
'src/core/ext/transport/chttp2/transport/frame.h',
'src/core/ext/transport/chttp2/transport/frame_data.h',
'src/core/ext/transport/chttp2/transport/frame_goaway.h',
'src/core/ext/transport/chttp2/transport/frame_ping.h',
'src/core/ext/transport/chttp2/transport/frame_rst_stream.h',
'src/core/ext/transport/chttp2/transport/frame_settings.h',
'src/core/ext/transport/chttp2/transport/frame_window_update.h',
'src/core/ext/transport/chttp2/transport/hpack_encoder.h',
'src/core/ext/transport/chttp2/transport/hpack_parser.h',
'src/core/ext/transport/chttp2/transport/hpack_table.h',
'src/core/ext/transport/chttp2/transport/http2_settings.h',
'src/core/ext/transport/chttp2/transport/huffsyms.h',
'src/core/ext/transport/chttp2/transport/incoming_metadata.h',
'src/core/ext/transport/chttp2/transport/internal.h',
'src/core/ext/transport/chttp2/transport/stream_map.h',
'src/core/ext/transport/chttp2/transport/varint.h',
'src/core/ext/transport/chttp2/alpn/alpn.h',
'src/core/ext/filters/http/client/http_client_filter.h',
'src/core/ext/filters/http/message_compress/message_compress_filter.h',
'src/core/ext/filters/http/server/http_server_filter.h',
'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds.h',
'src/core/lib/security/context/security_context.h',
'src/core/lib/security/credentials/alts/alts_credentials.h',
'src/core/lib/security/credentials/composite/composite_credentials.h',
'src/core/lib/security/credentials/credentials.h',
'src/core/lib/security/credentials/fake/fake_credentials.h',
'src/core/lib/security/credentials/google_default/google_default_credentials.h',
'src/core/lib/security/credentials/iam/iam_credentials.h',
'src/core/lib/security/credentials/jwt/json_token.h',
'src/core/lib/security/credentials/jwt/jwt_credentials.h',
'src/core/lib/security/credentials/jwt/jwt_verifier.h',
'src/core/lib/security/credentials/local/local_credentials.h',
'src/core/lib/security/credentials/oauth2/oauth2_credentials.h',
'src/core/lib/security/credentials/plugin/plugin_credentials.h',
'src/core/lib/security/credentials/ssl/ssl_credentials.h',
'src/core/lib/security/credentials/tls/grpc_tls_credentials_options.h',
'src/core/lib/security/credentials/tls/spiffe_credentials.h',
'src/core/lib/security/security_connector/alts/alts_security_connector.h',
'src/core/lib/security/security_connector/fake/fake_security_connector.h',
'src/core/lib/security/security_connector/load_system_roots.h',
'src/core/lib/security/security_connector/load_system_roots_linux.h',
'src/core/lib/security/security_connector/local/local_security_connector.h',
'src/core/lib/security/security_connector/security_connector.h',
'src/core/lib/security/security_connector/ssl/ssl_security_connector.h',
'src/core/lib/security/security_connector/ssl_utils.h',
'src/core/lib/security/security_connector/tls/spiffe_security_connector.h',
'src/core/lib/security/transport/auth_filters.h',
'src/core/lib/security/transport/secure_endpoint.h',
'src/core/lib/security/transport/security_handshaker.h',
'src/core/lib/security/transport/target_authority_table.h',
'src/core/lib/security/transport/tsi_error.h',
'src/core/lib/security/util/json_util.h',
'src/core/tsi/alts/crypt/gsec.h',
'src/core/tsi/alts/frame_protector/alts_counter.h',
'src/core/tsi/alts/frame_protector/alts_crypter.h',
'src/core/tsi/alts/frame_protector/alts_frame_protector.h',
'src/core/tsi/alts/frame_protector/alts_record_protocol_crypter_common.h',
'src/core/tsi/alts/frame_protector/frame_handler.h',
'src/core/tsi/alts/handshaker/alts_handshaker_client.h',
'src/core/tsi/alts/handshaker/alts_shared_resource.h',
'src/core/tsi/alts/handshaker/alts_tsi_handshaker.h',
'src/core/tsi/alts/handshaker/alts_tsi_handshaker_private.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_integrity_only_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_privacy_integrity_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_grpc_record_protocol_common.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_iovec_record_protocol.h',
'src/core/tsi/alts/zero_copy_frame_protector/alts_zero_copy_grpc_protector.h',
'src/core/lib/security/credentials/alts/check_gcp_environment.h',
'src/core/lib/security/credentials/alts/grpc_alts_credentials_options.h',
'src/core/tsi/alts/handshaker/alts_tsi_utils.h',
'src/core/tsi/alts/handshaker/transport_security_common_api.h',
'src/core/ext/upb-generated/src/proto/grpc/gcp/altscontext.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/gcp/handshaker.upb.h',
'src/core/ext/upb-generated/src/proto/grpc/gcp/transport_security_common.upb.h',
'third_party/upb/upb/decode.h',
'third_party/upb/upb/encode.h',
'third_party/upb/upb/generated_util.h',
'third_party/upb/upb/msg.h',
'third_party/upb/upb/port_def.inc',
'third_party/upb/upb/port_undef.inc',
'third_party/upb/upb/table.int.h',
'third_party/upb/upb/upb.h',
'src/core/tsi/transport_security.h',
'src/core/tsi/transport_security_interface.h',
'src/core/ext/transport/chttp2/client/authority.h',
'src/core/ext/transport/chttp2/client/chttp2_connector.h',
'src/core/ext/filters/client_channel/backup_poller.h',
'src/core/ext/filters/client_channel/client_channel.h',
'src/core/ext/filters/client_channel/client_channel_channelz.h',
'src/core/ext/filters/client_channel/client_channel_factory.h',
'src/core/ext/filters/client_channel/connector.h',
'src/core/ext/filters/client_channel/global_subchannel_pool.h',
'src/core/ext/filters/client_channel/health/health_check_client.h',
'src/core/ext/filters/client_channel/http_connect_handshaker.h',
'src/core/ext/filters/client_channel/http_proxy.h',
'src/core/ext/filters/client_channel/lb_policy.h',
'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',
'src/core/ext/filters/client_channel/resolver_factory.h',
'src/core/ext/filters/client_channel/resolver_registry.h',
'src/core/ext/filters/client_channel/resolver_result_parsing.h',
'src/core/ext/filters/client_channel/resolving_lb_policy.h',
'src/core/ext/filters/client_channel/retry_throttle.h',
'src/core/ext/filters/client_channel/server_address.h',
'src/core/ext/filters/client_channel/service_config.h',
'src/core/ext/filters/client_channel/subchannel.h',
'src/core/ext/filters/client_channel/subchannel_interface.h',
'src/core/ext/filters/client_channel/subchannel_pool_interface.h',
'src/core/ext/filters/deadline/deadline_filter.h',
'src/core/ext/upb-generated/src/proto/grpc/health/v1/health.upb.h',
'src/core/tsi/fake_transport_security.h',
'src/core/tsi/local_transport_security.h',
'src/core/tsi/ssl/session_cache/ssl_session.h',
'src/core/tsi/ssl/session_cache/ssl_session_cache.h',
'src/core/tsi/ssl_transport_security.h',
'src/core/tsi/ssl_types.h',
'src/core/tsi/transport_security_grpc.h',
'src/core/tsi/grpc_shadow_boringssl.h',
'src/core/ext/transport/chttp2/server/chttp2_server.h',
'src/core/ext/transport/inproc/inproc_transport.h',
'src/core/lib/avl/avl.h',
'src/core/lib/backoff/backoff.h',
'src/core/lib/channel/channel_args.h',
'src/core/lib/channel/channel_stack.h',
'src/core/lib/channel/channel_stack_builder.h',
'src/core/lib/channel/channel_trace.h',
'src/core/lib/channel/channelz.h',
'src/core/lib/channel/channelz_registry.h',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/context.h',
'src/core/lib/channel/handshaker.h',
'src/core/lib/channel/handshaker_factory.h',
'src/core/lib/channel/handshaker_registry.h',
'src/core/lib/channel/status_util.h',
'src/core/lib/compression/algorithm_metadata.h',
'src/core/lib/compression/compression_args.h',
'src/core/lib/compression/compression_internal.h',
'src/core/lib/compression/message_compress.h',
'src/core/lib/compression/stream_compression.h',
'src/core/lib/compression/stream_compression_gzip.h',
'src/core/lib/compression/stream_compression_identity.h',
'src/core/lib/debug/stats.h',
'src/core/lib/debug/stats_data.h',
'src/core/lib/gprpp/debug_location.h',
'src/core/lib/gprpp/inlined_vector.h',
'src/core/lib/gprpp/optional.h',
'src/core/lib/gprpp/orphanable.h',
'src/core/lib/gprpp/ref_counted.h',
'src/core/lib/gprpp/ref_counted_ptr.h',
'src/core/lib/gprpp/string_view.h',
'src/core/lib/http/format_request.h',
'src/core/lib/http/httpcli.h',
'src/core/lib/http/parser.h',
'src/core/lib/iomgr/block_annotate.h',
'src/core/lib/iomgr/buffer_list.h',
'src/core/lib/iomgr/call_combiner.h',
'src/core/lib/iomgr/cfstream_handle.h',
'src/core/lib/iomgr/closure.h',
'src/core/lib/iomgr/combiner.h',
'src/core/lib/iomgr/dynamic_annotations.h',
'src/core/lib/iomgr/endpoint.h',
'src/core/lib/iomgr/endpoint_cfstream.h',
'src/core/lib/iomgr/endpoint_pair.h',
'src/core/lib/iomgr/error.h',
'src/core/lib/iomgr/error_cfstream.h',
'src/core/lib/iomgr/error_internal.h',
'src/core/lib/iomgr/ev_epoll1_linux.h',
'src/core/lib/iomgr/ev_epollex_linux.h',
'src/core/lib/iomgr/ev_poll_posix.h',
'src/core/lib/iomgr/ev_posix.h',
'src/core/lib/iomgr/exec_ctx.h',
'src/core/lib/iomgr/executor.h',
'src/core/lib/iomgr/executor/mpmcqueue.h',
'src/core/lib/iomgr/executor/threadpool.h',
'src/core/lib/iomgr/gethostname.h',
'src/core/lib/iomgr/grpc_if_nametoindex.h',
'src/core/lib/iomgr/internal_errqueue.h',
'src/core/lib/iomgr/iocp_windows.h',
'src/core/lib/iomgr/iomgr.h',
'src/core/lib/iomgr/iomgr_custom.h',
'src/core/lib/iomgr/iomgr_internal.h',
'src/core/lib/iomgr/iomgr_posix.h',
'src/core/lib/iomgr/is_epollexclusive_available.h',
'src/core/lib/iomgr/load_file.h',
'src/core/lib/iomgr/lockfree_event.h',
'src/core/lib/iomgr/nameser.h',
'src/core/lib/iomgr/polling_entity.h',
'src/core/lib/iomgr/pollset.h',
'src/core/lib/iomgr/pollset_custom.h',
'src/core/lib/iomgr/pollset_set.h',
'src/core/lib/iomgr/pollset_set_custom.h',
'src/core/lib/iomgr/pollset_set_windows.h',
'src/core/lib/iomgr/pollset_windows.h',
'src/core/lib/iomgr/port.h',
'src/core/lib/iomgr/resolve_address.h',
'src/core/lib/iomgr/resolve_address_custom.h',
'src/core/lib/iomgr/resource_quota.h',
'src/core/lib/iomgr/sockaddr.h',
'src/core/lib/iomgr/sockaddr_custom.h',
'src/core/lib/iomgr/sockaddr_posix.h',
'src/core/lib/iomgr/sockaddr_utils.h',
'src/core/lib/iomgr/sockaddr_windows.h',
'src/core/lib/iomgr/socket_factory_posix.h',
'src/core/lib/iomgr/socket_mutator.h',
'src/core/lib/iomgr/socket_utils.h',
'src/core/lib/iomgr/socket_utils_posix.h',
'src/core/lib/iomgr/socket_windows.h',
'src/core/lib/iomgr/sys_epoll_wrapper.h',
'src/core/lib/iomgr/tcp_client.h',
'src/core/lib/iomgr/tcp_client_posix.h',
'src/core/lib/iomgr/tcp_custom.h',
'src/core/lib/iomgr/tcp_posix.h',
'src/core/lib/iomgr/tcp_server.h',
'src/core/lib/iomgr/tcp_server_utils_posix.h',
'src/core/lib/iomgr/tcp_windows.h',
'src/core/lib/iomgr/time_averaged_stats.h',
'src/core/lib/iomgr/timer.h',
'src/core/lib/iomgr/timer_custom.h',
'src/core/lib/iomgr/timer_heap.h',
'src/core/lib/iomgr/timer_manager.h',
'src/core/lib/iomgr/udp_server.h',
'src/core/lib/iomgr/unix_sockets_posix.h',
'src/core/lib/iomgr/wakeup_fd_pipe.h',
'src/core/lib/iomgr/wakeup_fd_posix.h',
'src/core/lib/json/json.h',
'src/core/lib/json/json_common.h',
'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h',
'src/core/lib/slice/b64.h',
'src/core/lib/slice/percent_encoding.h',
'src/core/lib/slice/slice_hash_table.h',
'src/core/lib/slice/slice_internal.h',
'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/slice/slice_utils.h',
'src/core/lib/slice/slice_weak_hash_table.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
'src/core/lib/surface/call_test_only.h',
'src/core/lib/surface/channel.h',
'src/core/lib/surface/channel_init.h',
'src/core/lib/surface/channel_stack_type.h',
'src/core/lib/surface/completion_queue.h',
'src/core/lib/surface/completion_queue_factory.h',
'src/core/lib/surface/event_string.h',
'src/core/lib/surface/init.h',
'src/core/lib/surface/lame_client.h',
'src/core/lib/surface/server.h',
'src/core/lib/surface/validate_metadata.h',
'src/core/lib/transport/bdp_estimator.h',
'src/core/lib/transport/byte_stream.h',
'src/core/lib/transport/connectivity_state.h',
'src/core/lib/transport/error_utils.h',
'src/core/lib/transport/http2_errors.h',
'src/core/lib/transport/metadata.h',
'src/core/lib/transport/metadata_batch.h',
'src/core/lib/transport/pid_controller.h',
'src/core/lib/transport/static_metadata.h',
'src/core/lib/transport/status_conversion.h',
'src/core/lib/transport/status_metadata.h',
'src/core/lib/transport/timeout_encoding.h',
'src/core/lib/transport/transport.h',
'src/core/lib/transport/transport_impl.h',
'src/core/lib/uri/uri_parser.h',
'src/core/lib/debug/trace.h',
'src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.h',
'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.h',
'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.h',
'src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.h',
'src/core/ext/upb-generated/src/proto/grpc/lb/v1/load_balancer.upb.h',
'src/core/ext/upb-generated/google/api/annotations.upb.h',
'src/core/ext/upb-generated/google/api/http.upb.h',
'src/core/ext/upb-generated/google/protobuf/any.upb.h',
'src/core/ext/upb-generated/google/protobuf/descriptor.upb.h',
'src/core/ext/upb-generated/google/protobuf/duration.upb.h',
'src/core/ext/upb-generated/google/protobuf/empty.upb.h',
'src/core/ext/upb-generated/google/protobuf/struct.upb.h',
'src/core/ext/upb-generated/google/protobuf/timestamp.upb.h',
'src/core/ext/upb-generated/google/protobuf/wrappers.upb.h',
'src/core/ext/upb-generated/google/rpc/status.upb.h',
'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_channel.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_client_stats.h',
'src/core/ext/filters/client_channel/lb_policy/xds/xds_load_balancer_api.h',
'src/core/ext/upb-generated/envoy/api/v2/auth/cert.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/cds.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/cluster/circuit_breaker.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/cluster/outlier_detection.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/discovery.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/eds.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/endpoint/endpoint.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/endpoint/load_report.upb.h',
'src/core/ext/upb-generated/envoy/service/discovery/v2/ads.upb.h',
'src/core/ext/upb-generated/envoy/service/load_stats/v2/lrs.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/core/address.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/core/base.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/core/config_source.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/core/grpc_service.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/core/health_check.upb.h',
'src/core/ext/upb-generated/envoy/api/v2/core/protocol.upb.h',
'src/core/ext/upb-generated/envoy/type/percent.upb.h',
'src/core/ext/upb-generated/envoy/type/range.upb.h',
'src/core/ext/upb-generated/gogoproto/gogo.upb.h',
'src/core/ext/upb-generated/validate/validate.upb.h',
'src/core/ext/filters/client_channel/lb_policy/subchannel_list.h',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h',
'src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h',
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.h',
'src/core/ext/filters/max_age/max_age_filter.h',
'src/core/ext/filters/message_size/message_size_filter.h',
'src/core/ext/filters/http/client_authority_filter.h',
'src/core/ext/filters/workarounds/workaround_cronet_compression_filter.h',
'src/core/ext/filters/workarounds/workaround_utils.h'
'src/cpp/client/cronet_credentials.cc'
ss.private_header_files = 'include/grpcpp/impl/codegen/core_codegen.h',
'src/cpp/client/secure_credentials.h',
@ -843,10 +483,6 @@ Pod::Spec.new do |s|
end
s.prepare_command = <<-END_OF_COMMAND
find src/cpp/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include <nanopb/\\1>;g'
find src/cpp/ -type f -path '*.grpc_back' -print0 | xargs -0 rm
find src/core/ -type f ! -path '*.grpc_back' -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(pb(_.*)?\\.h)";#include <nanopb/\\1>;g'
find src/core/ -type f -path '*.grpc_back' -print0 | xargs -0 rm
find src/core/ third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "upb/(.*)";#if COCOAPODS==1\\\n #include "third_party/upb/upb/\\1"\\\n#else\\\n #include "upb/\\1"\\\n#endif;g'
find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm
find src/core/ src/cpp/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "(.*).upb.h";#if COCOAPODS==1\\\n #include "src/core/ext/upb-generated/\\1.upb.h"\\\n#else\\\n #include "\\1.upb.h"\\\n#endif;g'

@ -185,7 +185,6 @@ Pod::Spec.new do |s|
ss.libraries = 'z'
ss.dependency "#{s.name}/Interface", version
ss.dependency 'BoringSSL-GRPC', '0.0.3'
ss.dependency 'nanopb', '~> 0.3'
ss.compiler_flags = '-DGRPC_SHADOW_BORINGSSL_SYMBOLS'
# To save you from scrolling, this is the last part of the podspec.
@ -945,6 +944,7 @@ Pod::Spec.new do |s|
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc',
'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc',
'src/core/ext/filters/census/grpc_context.cc',
'src/core/ext/filters/client_idle/client_idle_filter.cc',
'src/core/ext/filters/max_age/max_age_filter.cc',
@ -1479,7 +1479,6 @@ Pod::Spec.new do |s|
# TODO (mxyan): Instead of this hack, add include path "third_party" to C core's include path?
s.prepare_command = <<-END_OF_COMMAND
sed -E -i '' 's;#include "(pb(_.*)?\\.h)";#if COCOAPODS==1\\\n #include <nanopb/\\1>\\\n#else\\\n #include "\\1"\\\n#endif;g' $(find src/core -type f -print | xargs grep -H -c '#include <nanopb/' | grep 0$ | cut -d':' -f1)
sed -E -i '' 's;#include <openssl/(.*)>;#if COCOAPODS==1\\\n #include <openssl_grpc/\\1>\\\n#else\\\n #include <openssl/\\1>\\\n#endif;g' $(find src/core -type f \\( -path '*.h' -or -path '*.cc' \\) -print | xargs grep -H -c '#include <openssl_grpc/' | grep 0$ | cut -d':' -f1)
find src/core/ third_party/upb/ -type f \\( -name '*.h' -or -name '*.c' -or -name '*.cc' \\) -print0 | xargs -0 -L1 sed -E -i'.grpc_back' 's;#include "upb/(.*)";#if COCOAPODS==1\\\n #include "third_party/upb/upb/\\1"\\\n#else\\\n #include "upb/\\1"\\\n#endif;g'
find src/core/ third_party/upb/ -type f -name '*.grpc_back' -print0 | xargs -0 rm

@ -874,6 +874,7 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc )
s.files += %w( src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc )
s.files += %w( src/core/ext/filters/census/grpc_context.cc )
s.files += %w( src/core/ext/filters/client_idle/client_idle_filter.cc )
s.files += %w( src/core/ext/filters/max_age/max_age_filter.cc )

@ -55,7 +55,7 @@
'-Wall',
'-Wextra',
'-Werror',
'-Wno-unknown-warning-option',
'$(W_NO_UNKNOWN_WARNING_OPTION)',
'-Wno-long-long',
'-Wno-unused-parameter',
'-Wno-deprecated-declarations',
@ -68,7 +68,6 @@
'-Wno-maybe-uninitialized',
'-DPB_FIELD_32BIT',
'-DOSATOMIC_USE_INLINED=1',
'-Ithird_party/nanopb',
'-Ithird_party/upb',
'-Isrc/core/ext/upb-generated',
],
@ -87,7 +86,6 @@
'.',
'../..',
'include',
'../../third_party/nanopb',
],
'defines': [
'GRPC_ARES=0',
@ -146,7 +144,7 @@
'-Wall',
'-Wextra',
'-Werror',
'-Wno-unknown-warning-option',
'$(W_NO_UNKNOWN_WARNING_OPTION)',
'-Wno-long-long',
'-Wno-unused-parameter',
'-Wno-deprecated-declarations',
@ -159,7 +157,6 @@
'-Wno-maybe-uninitialized',
'-DPB_FIELD_32BIT',
'-DOSATOMIC_USE_INLINED=1',
'-Ithird_party/nanopb',
'-Ithird_party/upb',
'-Isrc/core/ext/upb-generated',
],
@ -168,7 +165,7 @@
'-Wall',
'-Wextra',
'-Werror',
'-Wno-unknown-warning-option',
'$(W_NO_UNKNOWN_WARNING_OPTION)',
'-Wno-long-long',
'-Wno-unused-parameter',
'-Wno-deprecated-declarations',
@ -181,7 +178,6 @@
'-Wno-maybe-uninitialized',
'-DPB_FIELD_32BIT',
'-DOSATOMIC_USE_INLINED=1',
'-Ithird_party/nanopb',
'-Ithird_party/upb',
'-Isrc/core/ext/upb-generated',
'-stdlib=libc++',
@ -657,6 +653,7 @@
'src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc',
'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc',
'src/core/ext/filters/census/grpc_context.cc',
'src/core/ext/filters/client_idle/client_idle_filter.cc',
'src/core/ext/filters/max_age/max_age_filter.cc',
@ -1434,6 +1431,7 @@
'src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc',
'src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc',
'src/core/ext/filters/client_channel/resolver/fake/fake_resolver.cc',
'src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc',
'src/core/ext/filters/client_channel/lb_policy/grpclb/client_load_reporting_filter.cc',
'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb.cc',
'src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_channel.cc',

@ -169,11 +169,7 @@ typedef struct {
#define GRPC_ARG_MAX_CONNECTION_AGE_GRACE_MS "grpc.max_connection_age_grace_ms"
/** Timeout after the last RPC finishes on the client channel at which the
* channel goes back into IDLE state. Int valued, milliseconds. INT_MAX means
* unlimited. */
/** TODO(qianchengz): Currently the default value is INT_MAX, which means the
* client idle filter is disabled by default. After the client idle filter
* proves no perfomance issue, we will change the default value to a reasonable
* value. */
* unlimited. The default value is 30 minutes and the min value is 1 second. */
#define GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS "grpc.client_idle_timeout_ms"
/** Enable/disable support for per-message compression. Defaults to 1, unless
GRPC_ARG_MINIMAL_STACK is enabled, in which case it defaults to 0. */
@ -330,6 +326,11 @@ typedef struct {
balancer before using fallback backend addresses from the resolver.
If 0, enter fallback mode immediately. Default value is 10000. */
#define GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS "grpc.xds_fallback_timeout_ms"
/* Time in milliseconds to wait before a locality is deleted after it's removed
from the received EDS update. If 0, delete the locality immediately. Default
value is 15 minutes. */
#define GRPC_ARG_LOCALITY_RETENTION_INTERVAL_MS \
"grpc.xds_locality_retention_interval_ms"
/** If non-zero, grpc server's cronet compression workaround will be enabled */
#define GRPC_ARG_WORKAROUND_CRONET_COMPRESSION \
"grpc.workaround.cronet_compression"

@ -85,6 +85,7 @@ class ClientCallbackReaderImpl;
template <class Request>
class ClientCallbackWriterImpl;
class ClientCallbackUnaryImpl;
class ClientContextAccessor;
} // namespace internal
class CallCredentials;
@ -424,6 +425,7 @@ class ClientContext {
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 grpc::string& debug_error_string) {

@ -83,14 +83,9 @@ Status GenericDeserialize(ByteBuffer* buffer,
if (!reader.status().ok()) {
return reader.status();
}
::grpc::protobuf::io::CodedInputStream decoder(&reader);
decoder.SetTotalBytesLimit(INT_MAX, INT_MAX);
if (!msg->ParseFromCodedStream(&decoder)) {
if (!msg->ParseFromZeroCopyStream(&reader)) {
result = Status(StatusCode::INTERNAL, msg->InitializationErrorString());
}
if (!decoder.ConsumedEntireMessage()) {
result = Status(StatusCode::INTERNAL, "Did not read entire message");
}
}
buffer->Clear();
return result;

@ -879,6 +879,7 @@
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/dns_resolver_selection.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/dns/native/dns_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/sockaddr/sockaddr_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_channel/resolver/xds/xds_resolver.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/census/grpc_context.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/client_idle/client_idle_filter.cc" role="src" />
<file baseinstalldir="/" name="src/core/ext/filters/max_age/max_age_filter.cc" role="src" />

@ -47,7 +47,6 @@ if 'linux' in sys.platform:
CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_linux'),)
if 'openbsd' in sys.platform:
CARES_INCLUDE += (os.path.join('third_party', 'cares', 'config_openbsd'),)
NANOPB_INCLUDE = (os.path.join('third_party', 'nanopb'),)
SSL_INCLUDE = (os.path.join('third_party', 'boringssl', 'include'),)
UPB_INCLUDE = (os.path.join('third_party', 'upb'),)
UPB_GRPC_GENERATED_INCLUDE = (os.path.join('src', 'core', 'ext', 'upb-generated'),)
@ -209,7 +208,6 @@ EXTENSION_INCLUDE_DIRECTORIES = (
CORE_INCLUDE +
ADDRESS_SORTING_INCLUDE +
CARES_INCLUDE +
NANOPB_INCLUDE +
SSL_INCLUDE +
UPB_INCLUDE +
UPB_GRPC_GENERATED_INCLUDE +

@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import os
import sys
import glob
@ -27,7 +28,7 @@ out['libs'] = [{
'name': 'benchmark',
'build': 'private',
'language': 'c++',
'secure': 'no',
'secure': False,
'defaults': 'benchmark',
'src': sorted(glob.glob('third_party/benchmark/src/*.cc')),
'headers': sorted(
@ -35,4 +36,4 @@ out['libs'] = [{
glob.glob('third_party/benchmark/include/benchmark/*.h')),
}]
print yaml.dump(out)
print(yaml.dump(out))

@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
import shutil
import sys
import os
@ -28,7 +29,7 @@ sys.path.append(os.path.join(boring_ssl_root, 'util'))
try:
import generate_build_files
except ImportError:
print yaml.dump({})
print(yaml.dump({}))
sys.exit()
def map_dir(filename):
@ -61,7 +62,7 @@ class Grpc(object):
'name': 'boringssl',
'build': 'private',
'language': 'c',
'secure': 'no',
'secure': False,
'src': sorted(
map_dir(f)
for f in files['ssl'] + files['crypto']
@ -79,7 +80,7 @@ class Grpc(object):
'name': 'boringssl_test_util',
'build': 'private',
'language': 'c++',
'secure': 'no',
'secure': False,
'boringssl': True,
'defaults': 'boringssl',
'src': [
@ -93,7 +94,7 @@ class Grpc(object):
'name': 'boringssl_%s' % test,
'build': 'test',
'run': False,
'secure': 'no',
'secure': False,
'language': 'c++',
'src': sorted(map_dir(f) for f in files[test]),
'vs_proj_dir': 'test/boringssl',
@ -135,7 +136,7 @@ try:
g = Grpc()
generate_build_files.main([g])
print yaml.dump(g.yaml)
print(yaml.dump(g.yaml))
finally:
shutil.rmtree('src')

@ -53,7 +53,7 @@ try:
'defaults': 'ares',
'build': 'private',
'language': 'c',
'secure': 'no',
'secure': False,
'src': [
"third_party/cares/cares/ares__close_sockets.c",
"third_party/cares/cares/ares__get_hostent.c",

@ -40,13 +40,11 @@ namespace {
// Prints out the method using the ruby gRPC DSL.
void PrintMethod(const MethodDescriptor* method, const grpc::string& package,
Printer* out) {
grpc::string input_type =
RubyTypeOf(method->input_type()->full_name(), package);
grpc::string input_type = RubyTypeOf(method->input_type(), package);
if (method->client_streaming()) {
input_type = "stream(" + input_type + ")";
}
grpc::string output_type =
RubyTypeOf(method->output_type()->full_name(), package);
grpc::string output_type = RubyTypeOf(method->output_type(), package);
if (method->server_streaming()) {
output_type = "stream(" + output_type + ")";
}
@ -160,13 +158,7 @@ grpc::string GetServices(const FileDescriptor* file) {
return output;
}
std::string package_name;
if (file->options().has_ruby_package()) {
package_name = file->options().ruby_package();
} else {
package_name = file->package();
}
std::string package_name = RubyPackage(file);
// Write out a file header.
std::map<grpc::string, grpc::string> header_comment_vars = ListToDict({

@ -100,10 +100,29 @@ inline grpc::string Modularize(grpc::string s) {
return new_string;
}
// RubyPackage gets the ruby package in either proto or ruby_package format
inline grpc::string RubyPackage(const grpc::protobuf::FileDescriptor* file) {
grpc::string package_name = file->package();
if (file->options().has_ruby_package()) {
package_name = file->options().ruby_package();
// If :: is in the package convert the Ruby formated name
// -> A::B::C
// to use the dot seperator notation
// -> A.B.C
package_name = ReplaceAll(package_name, "::", ".");
}
return package_name;
}
// RubyTypeOf updates a proto type to the required ruby equivalent.
inline grpc::string RubyTypeOf(const grpc::string& a_type,
inline grpc::string RubyTypeOf(const grpc::protobuf::Descriptor* descriptor,
const grpc::string& package) {
grpc::string res(a_type);
std::string proto_type = descriptor->full_name();
if (descriptor->file()->options().has_ruby_package()) {
proto_type = RubyPackage(descriptor->file()) + "." + descriptor->name();
}
grpc::string res(proto_type);
ReplacePrefix(&res, package, ""); // remove the leading package if present
ReplacePrefix(&res, ".", ""); // remove the leading . (no package)
if (res.find('.') == grpc::string::npos) {

@ -3186,8 +3186,7 @@ void CallData::AddRetriableSendInitialMetadataOp(
if (GPR_UNLIKELY(retry_state->send_initial_metadata.idx.named
.grpc_previous_rpc_attempts != nullptr)) {
grpc_metadata_batch_remove(&retry_state->send_initial_metadata,
retry_state->send_initial_metadata.idx.named
.grpc_previous_rpc_attempts);
GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS);
}
if (GPR_UNLIKELY(num_attempts_completed_ > 0)) {
grpc_mdelem retry_md = grpc_mdelem_create(
@ -3197,7 +3196,7 @@ void CallData::AddRetriableSendInitialMetadataOp(
&retry_state->send_initial_metadata,
&retry_state
->send_initial_metadata_storage[send_initial_metadata_.list.count],
retry_md);
retry_md, GRPC_BATCH_GRPC_PREVIOUS_RPC_ATTEMPTS);
if (GPR_UNLIKELY(error != GRPC_ERROR_NONE)) {
gpr_log(GPR_ERROR, "error adding retry metadata: %s",
grpc_error_string(error));

@ -346,7 +346,8 @@ void HealthCheckClient::CallState::StartCall() {
&send_initial_metadata_, &path_metadata_storage_,
grpc_mdelem_from_slices(
GRPC_MDSTR_PATH,
GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH));
GRPC_MDSTR_SLASH_GRPC_DOT_HEALTH_DOT_V1_DOT_HEALTH_SLASH_WATCH),
GRPC_BATCH_PATH);
GPR_ASSERT(error == GRPC_ERROR_NONE);
payload_.send_initial_metadata.send_initial_metadata =
&send_initial_metadata_;

@ -109,6 +109,7 @@
#define GRPC_XDS_RECONNECT_JITTER 0.2
#define GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS 10000
#define GRPC_XDS_MIN_CLIENT_LOAD_REPORTING_INTERVAL_MS 1000
#define GRPC_XDS_DEFAULT_LOCALITY_RETENTION_INTERVAL_MS (15 * 60 * 1000)
namespace grpc_core {
@ -452,15 +453,15 @@ class XdsLb : public LoadBalancingPolicy {
class LocalityEntry : public InternallyRefCounted<LocalityEntry> {
public:
LocalityEntry(RefCountedPtr<XdsLb> parent,
RefCountedPtr<XdsLocalityName> name,
uint32_t locality_weight);
RefCountedPtr<XdsLocalityName> name);
~LocalityEntry();
void UpdateLocked(ServerAddressList serverlist,
void UpdateLocked(uint32_t locality_weight, ServerAddressList serverlist,
LoadBalancingPolicy::Config* child_policy_config,
const grpc_channel_args* args);
void ShutdownLocked();
void ResetBackoffLocked();
void DeactivateLocked();
void Orphan() override;
grpc_connectivity_state connectivity_state() const {
@ -504,27 +505,31 @@ class XdsLb : public LoadBalancingPolicy {
grpc_channel_args* CreateChildPolicyArgsLocked(
const grpc_channel_args* args);
static void OnDelayedRemovalTimerLocked(void* arg, grpc_error* error);
RefCountedPtr<XdsLb> parent_;
RefCountedPtr<XdsLocalityName> name_;
OrphanablePtr<LoadBalancingPolicy> child_policy_;
OrphanablePtr<LoadBalancingPolicy> pending_child_policy_;
RefCountedPtr<PickerWrapper> picker_wrapper_;
grpc_connectivity_state connectivity_state_;
grpc_connectivity_state connectivity_state_ = GRPC_CHANNEL_IDLE;
uint32_t locality_weight_;
grpc_closure on_delayed_removal_timer_;
grpc_timer delayed_removal_timer_;
bool delayed_removal_timer_callback_pending_ = false;
};
explicit LocalityMap(XdsLb* xds_policy) : xds_policy_(xds_policy) {}
void UpdateLocked(const XdsLocalityList& locality_list,
LoadBalancingPolicy::Config* child_policy_config,
const grpc_channel_args* args, XdsLb* parent);
const grpc_channel_args* args, XdsLb* parent,
bool is_initial_update = false);
void UpdateXdsPickerLocked();
void ShutdownLocked();
void ResetBackoffLocked();
private:
void PruneLocalities(const XdsLocalityList& locality_list);
XdsLb* xds_policy_;
Map<RefCountedPtr<XdsLocalityName>, OrphanablePtr<LocalityEntry>,
XdsLocalityName::Less>
@ -575,7 +580,7 @@ class XdsLb : public LoadBalancingPolicy {
OrphanablePtr<LbChannelState> pending_lb_chand_;
// Timeout in milliseconds for the LB call. 0 means no deadline.
int lb_call_timeout_ms_ = 0;
const grpc_millis lb_call_timeout_ms_;
// Whether the checks for fallback at startup are ALL pending. There are
// several cases where this can be reset:
@ -587,7 +592,7 @@ class XdsLb : public LoadBalancingPolicy {
bool fallback_at_startup_checks_pending_ = false;
// Timeout in milliseconds for before using fallback backend addresses.
// 0 means not using fallback.
int lb_fallback_timeout_ms_ = 0;
const grpc_millis lb_fallback_timeout_ms_;
// The backend addresses from the resolver.
ServerAddressList fallback_backend_addresses_;
// Fallback timer.
@ -602,6 +607,7 @@ class XdsLb : public LoadBalancingPolicy {
// The policy to use for the backends.
RefCountedPtr<LoadBalancingPolicy::Config> child_policy_config_;
const grpc_millis locality_retention_interval_ms_;
// Map of policies to use in the backend
LocalityMap locality_map_;
// TODO(mhaidry) : Add support for multiple maps of localities
@ -1705,7 +1711,16 @@ grpc_channel_args* BuildBalancerChannelArgs(const grpc_channel_args* args) {
//
XdsLb::XdsLb(Args args)
: LoadBalancingPolicy(std::move(args)), locality_map_(this) {
: LoadBalancingPolicy(std::move(args)),
lb_call_timeout_ms_(grpc_channel_args_find_integer(
args.args, GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS, {0, 0, INT_MAX})),
lb_fallback_timeout_ms_(grpc_channel_args_find_integer(
args.args, GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS,
{GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS, 0, INT_MAX})),
locality_retention_interval_ms_(grpc_channel_args_find_integer(
args.args, GRPC_ARG_LOCALITY_RETENTION_INTERVAL_MS,
{GRPC_XDS_DEFAULT_LOCALITY_RETENTION_INTERVAL_MS, 0, INT_MAX})),
locality_map_(this) {
// Record server name.
const grpc_arg* arg = grpc_channel_args_find(args.args, GRPC_ARG_SERVER_URI);
const char* server_uri = grpc_channel_arg_get_string(arg);
@ -1719,13 +1734,6 @@ XdsLb::XdsLb(Args args)
server_name_);
}
grpc_uri_destroy(uri);
// Record LB call timeout.
arg = grpc_channel_args_find(args.args, GRPC_ARG_GRPCLB_CALL_TIMEOUT_MS);
lb_call_timeout_ms_ = grpc_channel_arg_get_integer(arg, {0, 0, INT_MAX});
// Record fallback timeout.
arg = grpc_channel_args_find(args.args, GRPC_ARG_XDS_FALLBACK_TIMEOUT_MS);
lb_fallback_timeout_ms_ = grpc_channel_arg_get_integer(
arg, {GRPC_XDS_DEFAULT_FALLBACK_TIMEOUT_MS, 0, INT_MAX});
}
XdsLb::~XdsLb() {
@ -1824,6 +1832,7 @@ void XdsLb::ProcessAddressesAndChannelArgsLocked(
void XdsLb::ParseLbConfig(const ParsedXdsConfig* xds_config) {
if (xds_config == nullptr || xds_config->balancer_name() == nullptr) return;
// TODO(yashykt) : does this need to be a gpr_strdup
// TODO(juanlishen): Read balancer name from bootstrap file.
balancer_name_ = UniquePtr<char>(gpr_strdup(xds_config->balancer_name()));
child_policy_config_ = xds_config->child_policy();
fallback_policy_config_ = xds_config->fallback_policy();
@ -1838,7 +1847,7 @@ void XdsLb::UpdateLocked(UpdateArgs args) {
}
ProcessAddressesAndChannelArgsLocked(std::move(args.addresses), *args.args);
locality_map_.UpdateLocked(locality_list_, child_policy_config_.get(), args_,
this);
this, is_initial_update);
// Update the existing fallback policy. The fallback policy config and/or the
// fallback addresses may be new.
if (fallback_policy_ != nullptr) UpdateFallbackPolicyLocked();
@ -2036,27 +2045,12 @@ void XdsLb::MaybeExitFallbackMode() {
// XdsLb::LocalityMap
//
void XdsLb::LocalityMap::PruneLocalities(const XdsLocalityList& locality_list) {
for (auto iter = map_.begin(); iter != map_.end();) {
bool found = false;
for (size_t i = 0; i < locality_list.size(); i++) {
if (*locality_list[i].locality_name == *iter->first) {
found = true;
break;
}
}
if (!found) { // Remove entries not present in the locality list.
iter = map_.erase(iter);
} else
iter++;
}
}
void XdsLb::LocalityMap::UpdateLocked(
const XdsLocalityList& locality_list,
LoadBalancingPolicy::Config* child_policy_config,
const grpc_channel_args* args, XdsLb* parent) {
const grpc_channel_args* args, XdsLb* parent, bool is_initial_update) {
if (parent->shutting_down_) return;
// Add or update the localities in locality_list.
for (size_t i = 0; i < locality_list.size(); i++) {
auto& locality_name = locality_list[i].locality_name;
auto iter = map_.find(locality_name);
@ -2064,19 +2058,35 @@ void XdsLb::LocalityMap::UpdateLocked(
// locality list.
if (iter == map_.end()) {
OrphanablePtr<LocalityEntry> new_entry = MakeOrphanable<LocalityEntry>(
parent->Ref(DEBUG_LOCATION, "LocalityEntry"), locality_name,
locality_list[i].lb_weight);
parent->Ref(DEBUG_LOCATION, "LocalityEntry"), locality_name);
iter = map_.emplace(locality_name, std::move(new_entry)).first;
}
// Keep a copy of serverlist in locality_list_ so that we can compare it
// with the future ones.
iter->second->UpdateLocked(locality_list[i].serverlist, child_policy_config,
iter->second->UpdateLocked(locality_list[i].lb_weight,
locality_list[i].serverlist, child_policy_config,
args);
}
PruneLocalities(locality_list);
// Remove (later) the localities not in locality_list.
for (auto& p : map_) {
const XdsLocalityName* locality_name = p.first.get();
LocalityEntry* locality_entry = p.second.get();
bool in_locality_list = false;
for (size_t i = 0; i < locality_list.size(); ++i) {
if (*locality_list[i].locality_name == *locality_name) {
in_locality_list = true;
break;
}
}
if (!in_locality_list) locality_entry->DeactivateLocked();
}
// Generate a new xds picker immediately.
if (!is_initial_update) UpdateXdsPickerLocked();
}
void XdsLb::LocalityMap::UpdateXdsPickerLocked() {
// If we are in fallback mode, don't generate an xds picker from localities.
if (xds_policy_->fallback_policy_ != nullptr) return;
// Construct a new xds picker which maintains a map of all locality pickers
// that are ready. Each locality is represented by a portion of the range
// proportional to its weight, such that the total range is the sum of the
@ -2087,23 +2097,8 @@ void XdsLb::LocalityMap::UpdateXdsPickerLocked() {
size_t num_transient_failures = 0;
Picker::PickerList pickers;
for (auto& p : map_) {
// TODO(juanlishen): We should prune a locality (and kill its stats) after
// we know we won't pick from it. We need to improve our update logic to
// make that easier. Consider the following situation: the current map has
// two READY localities A and B, and the update only contains B with the
// same addresses as before. Without the following hack, we will generate
// the same picker containing A and B because we haven't pruned A when the
// update happens. Remove the for loop below once we implement the locality
// map update.
bool in_locality_list = false;
for (size_t i = 0; i < xds_policy_->locality_list_.size(); ++i) {
if (*xds_policy_->locality_list_[i].locality_name == *p.first) {
in_locality_list = true;
break;
}
}
if (!in_locality_list) continue;
const LocalityEntry* entry = p.second.get();
if (entry->locality_weight() == 0) continue;
switch (entry->connectivity_state()) {
case GRPC_CHANNEL_READY: {
end += entry->locality_weight();
@ -2122,10 +2117,8 @@ void XdsLb::LocalityMap::UpdateXdsPickerLocked() {
num_transient_failures++;
break;
}
default: {
gpr_log(GPR_ERROR, "Invalid locality connectivity state - %d",
entry->connectivity_state());
}
default:
GPR_UNREACHABLE_CODE(return );
}
}
// Pass on the constructed xds picker if it has any ready pickers in their map
@ -2149,11 +2142,9 @@ void XdsLb::LocalityMap::UpdateXdsPickerLocked() {
UniquePtr<SubchannelPicker>(
New<QueuePicker>(xds_policy_->Ref(DEBUG_LOCATION, "QueuePicker"))));
} else {
GPR_ASSERT(num_transient_failures ==
xds_policy_->locality_map_.map_.size());
grpc_error* error =
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"connections to all localities failing"),
"connections to all active localities failing"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE);
xds_policy_->channel_control_helper()->UpdateState(
GRPC_CHANNEL_TRANSIENT_FAILURE,
@ -2174,15 +2165,14 @@ void XdsLb::LocalityMap::ResetBackoffLocked() {
//
XdsLb::LocalityMap::LocalityEntry::LocalityEntry(
RefCountedPtr<XdsLb> parent, RefCountedPtr<XdsLocalityName> name,
uint32_t locality_weight)
: parent_(std::move(parent)),
name_(std::move(name)),
locality_weight_(locality_weight) {
RefCountedPtr<XdsLb> parent, RefCountedPtr<XdsLocalityName> name)
: parent_(std::move(parent)), name_(std::move(name)) {
if (GRPC_TRACE_FLAG_ENABLED(grpc_lb_xds_trace)) {
gpr_log(GPR_INFO, "[xdslb %p] created LocalityEntry %p for %s",
parent_.get(), this, name_->AsHumanReadableString());
}
GRPC_CLOSURE_INIT(&on_delayed_removal_timer_, OnDelayedRemovalTimerLocked,
this, grpc_combiner_scheduler(parent_->combiner()));
}
XdsLb::LocalityMap::LocalityEntry::~LocalityEntry() {
@ -2246,10 +2236,15 @@ XdsLb::LocalityMap::LocalityEntry::CreateChildPolicyLocked(
}
void XdsLb::LocalityMap::LocalityEntry::UpdateLocked(
ServerAddressList serverlist,
uint32_t locality_weight, ServerAddressList serverlist,
LoadBalancingPolicy::Config* child_policy_config,
const grpc_channel_args* args_in) {
if (parent_->shutting_down_) return;
// Update locality weight.
locality_weight_ = locality_weight;
if (delayed_removal_timer_callback_pending_) {
grpc_timer_cancel(&delayed_removal_timer_);
}
// Construct update args.
UpdateArgs update_args;
update_args.addresses = std::move(serverlist);
@ -2374,6 +2369,9 @@ void XdsLb::LocalityMap::LocalityEntry::ShutdownLocked() {
// Drop our ref to the child's picker, in case it's holding a ref to
// the child.
picker_wrapper_.reset();
if (delayed_removal_timer_callback_pending_) {
grpc_timer_cancel(&delayed_removal_timer_);
}
}
void XdsLb::LocalityMap::LocalityEntry::ResetBackoffLocked() {
@ -2388,6 +2386,36 @@ void XdsLb::LocalityMap::LocalityEntry::Orphan() {
Unref();
}
void XdsLb::LocalityMap::LocalityEntry::DeactivateLocked() {
// If locality retaining is disabled, delete the locality immediately.
if (parent_->locality_retention_interval_ms_ == 0) {
parent_->locality_map_.map_.erase(name_);
return;
}
// If already deactivated, don't do that again.
if (locality_weight_ == 0) return;
// Set the locality weight to 0 so that future xds picker won't contain this
// locality.
locality_weight_ = 0;
// Start a timer to delete the locality.
Ref(DEBUG_LOCATION, "LocalityEntry+timer").release();
grpc_timer_init(
&delayed_removal_timer_,
ExecCtx::Get()->Now() + parent_->locality_retention_interval_ms_,
&on_delayed_removal_timer_);
delayed_removal_timer_callback_pending_ = true;
}
void XdsLb::LocalityMap::LocalityEntry::OnDelayedRemovalTimerLocked(
void* arg, grpc_error* error) {
LocalityEntry* self = static_cast<LocalityEntry*>(arg);
self->delayed_removal_timer_callback_pending_ = false;
if (error == GRPC_ERROR_NONE && self->locality_weight_ == 0) {
self->parent_->locality_map_.map_.erase(self->name_);
}
self->Unref(DEBUG_LOCATION, "LocalityEntry+timer");
}
//
// XdsLb::LocalityEntry::Helper
//
@ -2447,8 +2475,6 @@ void XdsLb::LocalityMap::LocalityEntry::Helper::UpdateState(
entry_->parent_->MaybeCancelFallbackAtStartupChecks();
entry_->parent_->MaybeExitFallbackMode();
}
// If we are in fallback mode, ignore update request from the child policy.
if (entry_->parent_->fallback_policy_ != nullptr) return;
GPR_ASSERT(entry_->parent_->lb_chand_ != nullptr);
// Cache the picker and its state in the entry.
entry_->picker_wrapper_ = MakeRefCounted<PickerWrapper>(
@ -2563,10 +2589,6 @@ class XdsFactory : public LoadBalancingPolicyFactory {
}
}
}
if (balancer_name == nullptr) {
error_list.push_back(GRPC_ERROR_CREATE_FROM_STATIC_STRING(
"field:balancerName error:not found"));
}
if (error_list.empty()) {
return RefCountedPtr<LoadBalancingPolicy::Config>(New<ParsedXdsConfig>(
balancer_name, std::move(child_policy), std::move(fallback_policy)));

@ -37,7 +37,7 @@ class XdsLocalityName : public RefCounted<XdsLocalityName> {
public:
struct Less {
bool operator()(const RefCountedPtr<XdsLocalityName>& lhs,
const RefCountedPtr<XdsLocalityName>& rhs) {
const RefCountedPtr<XdsLocalityName>& rhs) const {
int cmp_result = strcmp(lhs->region_.get(), rhs->region_.get());
if (cmp_result != 0) return cmp_result < 0;
cmp_result = strcmp(lhs->zone_.get(), rhs->zone_.get());

@ -137,6 +137,16 @@ UniquePtr<char> StringCopy(const upb_strview& strview) {
grpc_error* LocalityParse(
const envoy_api_v2_endpoint_LocalityLbEndpoints* locality_lb_endpoints,
XdsLocalityInfo* locality_info) {
// Parse LB weight.
const google_protobuf_UInt32Value* lb_weight =
envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight(
locality_lb_endpoints);
// If LB weight is not specified, it means this locality is assigned no load.
// TODO(juanlishen): When we support CDS to configure the inter-locality
// policy, we should change the LB weight handling.
locality_info->lb_weight =
lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0;
if (locality_info->lb_weight == 0) return GRPC_ERROR_NONE;
// Parse locality name.
const envoy_api_v2_core_Locality* locality =
envoy_api_v2_endpoint_LocalityLbEndpoints_locality(locality_lb_endpoints);
@ -154,14 +164,7 @@ grpc_error* LocalityParse(
&locality_info->serverlist);
if (error != GRPC_ERROR_NONE) return error;
}
// Parse the lb_weight and priority.
const google_protobuf_UInt32Value* lb_weight =
envoy_api_v2_endpoint_LocalityLbEndpoints_load_balancing_weight(
locality_lb_endpoints);
// If LB weight is not specified, the default weight 0 is used, which means
// this locality is assigned no load.
locality_info->lb_weight =
lb_weight != nullptr ? google_protobuf_UInt32Value_value(lb_weight) : 0;
// Parse the priority.
locality_info->priority =
envoy_api_v2_endpoint_LocalityLbEndpoints_priority(locality_lb_endpoints);
return GRPC_ERROR_NONE;
@ -253,6 +256,8 @@ grpc_error* XdsEdsResponseDecodeAndParse(const grpc_slice& encoded_response,
XdsLocalityInfo locality_info;
grpc_error* error = LocalityParse(endpoints[i], &locality_info);
if (error != GRPC_ERROR_NONE) return error;
// Filter out locality with weight 0.
if (locality_info.lb_weight == 0) continue;
update->locality_list.push_back(std::move(locality_info));
}
// The locality list is sorted here into deterministic order so that it's

@ -0,0 +1,89 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include <grpc/support/port_platform.h>
#include "src/core/ext/filters/client_channel/resolver_registry.h"
namespace grpc_core {
namespace {
class XdsResolver : public Resolver {
public:
explicit XdsResolver(ResolverArgs args)
: Resolver(args.combiner, std::move(args.result_handler)),
args_(grpc_channel_args_copy(args.args)) {}
~XdsResolver() override { grpc_channel_args_destroy(args_); }
void StartLocked() override;
void ShutdownLocked() override{};
private:
const grpc_channel_args* args_;
};
void XdsResolver::StartLocked() {
static const char* service_config =
"{\n"
" \"loadBalancingConfig\":[\n"
" { \"xds_experimental\":{} }\n"
" ]\n"
"}";
Result result;
result.args = args_;
args_ = nullptr;
grpc_error* error = GRPC_ERROR_NONE;
result.service_config = ServiceConfig::Create(service_config, &error);
result_handler()->ReturnResult(std::move(result));
}
//
// Factory
//
class XdsResolverFactory : public ResolverFactory {
public:
bool IsValidUri(const grpc_uri* uri) const override {
if (GPR_UNLIKELY(0 != strcmp(uri->authority, ""))) {
gpr_log(GPR_ERROR, "URI authority not supported");
return false;
}
return true;
}
OrphanablePtr<Resolver> CreateResolver(ResolverArgs args) const override {
if (!IsValidUri(args.uri)) return nullptr;
return OrphanablePtr<Resolver>(New<XdsResolver>(std::move(args)));
}
const char* scheme() const override { return "xds-experimental"; }
};
} // namespace
} // namespace grpc_core
void grpc_resolver_xds_init() {
grpc_core::ResolverRegistry::Builder::RegisterResolverFactory(
grpc_core::UniquePtr<grpc_core::ResolverFactory>(
grpc_core::New<grpc_core::XdsResolverFactory>()));
}
void grpc_resolver_xds_shutdown() {}

@ -27,12 +27,12 @@
#include "src/core/lib/surface/channel_init.h"
#include "src/core/lib/transport/http2_errors.h"
// The idle filter is disabled in client channel by default.
// To enable the idle filte, set GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS to [0, INT_MAX)
// in channel args.
// TODO(qianchengz): Find a reasonable default value. Maybe check what deault
// value Java uses.
#define DEFAULT_IDLE_TIMEOUT_MS INT_MAX
// The idle filter is enabled in client channel by default.
// Set GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS to [1000, INT_MAX) in channel args to
// configure the idle timeout.
#define DEFAULT_IDLE_TIMEOUT_MS (30 /*minutes*/ * 60 * 1000)
// The user input idle timeout smaller than this would be capped to it.
#define MIN_IDLE_TIMEOUT_MS (1 /*second*/ * 1000)
namespace grpc_core {
@ -47,10 +47,82 @@ TraceFlag grpc_trace_client_idle_filter(false, "client_idle_filter");
namespace {
/*
client_idle_filter maintains a state tracking if there are active calls in the
channel and its internal idle_timer_. The states are specified as following:
+--------------------------------------------+-------------+---------+
| ChannelState | idle_timer_ | channel |
+--------------------------------------------+-------------+---------+
| IDLE | unset | idle |
| CALLS_ACTIVE | unset | busy |
| TIMER_PENDING | set-valid | idle |
| TIMER_PENDING_CALLS_ACTIVE | set-invalid | busy |
| TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START | set-invalid | idle |
+--------------------------------------------+-------------+---------+
IDLE: The initial state of the client_idle_filter, indicating the channel is
in IDLE.
CALLS_ACTIVE: The channel has 1 or 1+ active calls and the timer is not set.
TIMER_PENDING: The state after the timer is set and no calls have arrived
after the timer is set. The channel must have 0 active call in this state. If
the timer is fired in this state, the channel will go into IDLE state.
TIMER_PENDING_CALLS_ACTIVE: The state after the timer is set and at least one
call has arrived after the timer is set. The channel must have 1 or 1+ active
calls in this state. If the timer is fired in this state, we won't reschedule
it.
TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START: The state after the timer is set
and at least one call has arrived after the timer is set, BUT the channel
currently has 0 active call. If the timer is fired in this state, we will
reschedule it according to the finish time of the latest call.
PROCESSING: The state set to block other threads when the setting thread is
doing some work to keep state consistency.
idle_timer_ will not be cancelled (unless the channel is shutting down).
If the timer callback is called when the idle_timer_ is valid (i.e. idle_state
is TIMER_PENDING), the channel will enter IDLE, otherwise the channel won't be
changed.
State transitions:
IDLE
| ^
--------------------------------- *
| *
v *
CALLS_ACTIVE =================> TIMER_PENDING
^ | ^
* ------------------------------ *
* | *
* v *
TIMER_PENDING_CALLS_ACTIVE ===> TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START
^ |
| |
---------------------------------
---> Triggered by IncreaseCallCount()
===> Triggered by DecreaseCallCount()
***> Triggered by IdleTimerCallback()
*/
enum ChannelState {
IDLE,
CALLS_ACTIVE,
TIMER_PENDING,
TIMER_PENDING_CALLS_ACTIVE,
TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START,
PROCESSING
};
grpc_millis GetClientIdleTimeout(const grpc_channel_args* args) {
return grpc_channel_arg_get_integer(
grpc_channel_args_find(args, GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS),
{DEFAULT_IDLE_TIMEOUT_MS, 0, INT_MAX});
return GPR_MAX(
grpc_channel_arg_get_integer(
grpc_channel_args_find(args, GRPC_ARG_CLIENT_IDLE_TIMEOUT_MS),
{DEFAULT_IDLE_TIMEOUT_MS, 0, INT_MAX}),
MIN_IDLE_TIMEOUT_MS);
}
class ChannelData {
@ -86,8 +158,9 @@ class ChannelData {
const grpc_millis client_idle_timeout_;
// Member data used to track the state of channel.
Mutex call_count_mu_;
size_t call_count_;
grpc_millis last_idle_time_;
Atomic<intptr_t> call_count_{0};
Atomic<ChannelState> state_{IDLE};
// Idle timer and its callback closure.
grpc_timer idle_timer_;
@ -115,37 +188,105 @@ void ChannelData::StartTransportOp(grpc_channel_element* elem,
ChannelData* chand = static_cast<ChannelData*>(elem->channel_data);
// Catch the disconnect_with_error transport op.
if (op->disconnect_with_error != nullptr) {
// Disconnect. Cancel the timer if we set it before.
// IncreaseCallCount() introduces a dummy call. It will cancel the timer and
// prevent the timer from being reset by other threads.
// IncreaseCallCount() introduces a dummy call and prevent the timer from
// being reset by other threads.
chand->IncreaseCallCount();
// If the timer has been set, cancel the timer.
// No synchronization issues here. grpc_timer_cancel() is valid as long as
// the timer has been init()ed before.
grpc_timer_cancel(&chand->idle_timer_);
}
// Pass the op to the next filter.
grpc_channel_next_op(elem, op);
}
void ChannelData::IncreaseCallCount() {
MutexLock lock(&call_count_mu_);
if (call_count_++ == 0) {
grpc_timer_cancel(&idle_timer_);
const intptr_t previous_value = call_count_.FetchAdd(1, MemoryOrder::RELAXED);
GRPC_IDLE_FILTER_LOG("call counter has increased to %" PRIuPTR,
previous_value + 1);
if (previous_value == 0) {
// This call is the one that makes the channel busy.
// Loop here to make sure the previous decrease operation has finished.
ChannelState state = state_.Load(MemoryOrder::RELAXED);
while (true) {
switch (state) {
// Timer has not been set. Switch to CALLS_ACTIVE.
case IDLE:
// In this case, no other threads will modify the state, so we can
// just store the value.
state_.Store(CALLS_ACTIVE, MemoryOrder::RELAXED);
return;
// Timer has been set. Switch to TIMER_PENDING_CALLS_ACTIVE.
case TIMER_PENDING:
case TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START:
// At this point, the state may have been switched to IDLE by the
// idle timer callback. Therefore, use CAS operation to change the
// state atomically.
// Use MemoryOrder::ACQUIRE on success to ensure last_idle_time_ has
// been properly set in DecreaseCallCount().
if (state_.CompareExchangeWeak(&state, TIMER_PENDING_CALLS_ACTIVE,
MemoryOrder::ACQUIRE,
MemoryOrder::RELAXED)) {
return;
}
break;
default:
// The state has not been switched to desired value yet, try again.
state = state_.Load(MemoryOrder::RELAXED);
break;
}
}
}
GRPC_IDLE_FILTER_LOG("call counter has increased to %" PRIuPTR, call_count_);
}
void ChannelData::DecreaseCallCount() {
MutexLock lock(&call_count_mu_);
if (call_count_-- == 1) {
StartIdleTimer();
const intptr_t previous_value = call_count_.FetchSub(1, MemoryOrder::RELAXED);
GRPC_IDLE_FILTER_LOG("call counter has decreased to %" PRIuPTR,
previous_value - 1);
if (previous_value == 1) {
// This call is the one that makes the channel idle.
// last_idle_time_ does not need to be Atomic<> because busy-loops in
// IncreaseCallCount(), DecreaseCallCount() and IdleTimerCallback() will
// prevent multiple threads from simultaneously accessing this variable.
last_idle_time_ = ExecCtx::Get()->Now();
ChannelState state = state_.Load(MemoryOrder::RELAXED);
while (true) {
switch (state) {
// Timer has not been set. Set the timer and switch to TIMER_PENDING
case CALLS_ACTIVE:
// Release store here to make other threads see the updated value of
// last_idle_time_.
StartIdleTimer();
state_.Store(TIMER_PENDING, MemoryOrder::RELEASE);
return;
// Timer has been set. Switch to
// TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START
case TIMER_PENDING_CALLS_ACTIVE:
// At this point, the state may have been switched to CALLS_ACTIVE by
// the idle timer callback. Therefore, use CAS operation to change the
// state atomically.
// Release store here to make the idle timer callback see the updated
// value of last_idle_time_ to properly reset the idle timer.
if (state_.CompareExchangeWeak(
&state, TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START,
MemoryOrder::RELEASE, MemoryOrder::RELAXED)) {
return;
}
break;
default:
// The state has not been switched to desired value yet, try again.
state = state_.Load(MemoryOrder::RELAXED);
break;
}
}
}
GRPC_IDLE_FILTER_LOG("call counter has decreased to %" PRIuPTR, call_count_);
}
ChannelData::ChannelData(grpc_channel_element* elem,
grpc_channel_element_args* args, grpc_error** error)
: elem_(elem),
channel_stack_(args->channel_stack),
client_idle_timeout_(GetClientIdleTimeout(args->channel_args)),
call_count_(0) {
client_idle_timeout_(GetClientIdleTimeout(args->channel_args)) {
// If the idle filter is explicitly disabled in channel args, this ctor should
// not get called.
GPR_ASSERT(client_idle_timeout_ != GRPC_MILLIS_INF_FUTURE);
@ -165,10 +306,45 @@ ChannelData::ChannelData(grpc_channel_element* elem,
void ChannelData::IdleTimerCallback(void* arg, grpc_error* error) {
GRPC_IDLE_FILTER_LOG("timer alarms");
ChannelData* chand = static_cast<ChannelData*>(arg);
{
MutexLock lock(&chand->call_count_mu_);
if (error == GRPC_ERROR_NONE && chand->call_count_ == 0) {
chand->EnterIdle();
if (error != GRPC_ERROR_NONE) {
GRPC_IDLE_FILTER_LOG("timer canceled");
GRPC_CHANNEL_STACK_UNREF(chand->channel_stack_, "max idle timer callback");
return;
}
bool finished = false;
ChannelState state = chand->state_.Load(MemoryOrder::RELAXED);
while (!finished) {
switch (state) {
case TIMER_PENDING:
// Change the state to PROCESSING to block IncreaseCallCout() until the
// EnterIdle() operation finishes, preventing mistakenly entering IDLE
// when active RPC exists.
finished = chand->state_.CompareExchangeWeak(
&state, PROCESSING, MemoryOrder::ACQUIRE, MemoryOrder::RELAXED);
if (finished) {
chand->EnterIdle();
chand->state_.Store(IDLE, MemoryOrder::RELAXED);
}
break;
case TIMER_PENDING_CALLS_ACTIVE:
finished = chand->state_.CompareExchangeWeak(
&state, CALLS_ACTIVE, MemoryOrder::RELAXED, MemoryOrder::RELAXED);
break;
case TIMER_PENDING_CALLS_SEEN_SINCE_TIMER_START:
// Change the state to PROCESSING to block IncreaseCallCount() until the
// StartIdleTimer() operation finishes, preventing mistakenly restarting
// the timer after grpc_timer_cancel() when shutdown.
finished = chand->state_.CompareExchangeWeak(
&state, PROCESSING, MemoryOrder::ACQUIRE, MemoryOrder::RELAXED);
if (finished) {
chand->StartIdleTimer();
chand->state_.Store(TIMER_PENDING, MemoryOrder::RELAXED);
}
break;
default:
// The state has not been switched to desired value yet, try again.
state = chand->state_.Load(MemoryOrder::RELAXED);
break;
}
}
GRPC_IDLE_FILTER_LOG("timer finishes");
@ -185,7 +361,7 @@ void ChannelData::StartIdleTimer() {
GRPC_IDLE_FILTER_LOG("timer has started");
// Hold a ref to the channel stack for the timer callback.
GRPC_CHANNEL_STACK_REF(channel_stack_, "max idle timer callback");
grpc_timer_init(&idle_timer_, ExecCtx::Get()->Now() + client_idle_timeout_,
grpc_timer_init(&idle_timer_, last_idle_time_ + client_idle_timeout_,
&idle_timer_callback_);
}
@ -194,7 +370,7 @@ void ChannelData::EnterIdle() {
// Hold a ref to the channel stack for the transport op.
GRPC_CHANNEL_STACK_REF(channel_stack_, "idle transport op");
// Initialize the transport op.
memset(&idle_transport_op_, 0, sizeof(idle_transport_op_));
idle_transport_op_ = {};
idle_transport_op_.disconnect_with_error = grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("enter idle"),
GRPC_ERROR_INT_CHANNEL_CONNECTIVITY_STATE, GRPC_CHANNEL_IDLE);

@ -109,7 +109,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_call_element* elem,
if (b->idx.named.grpc_status != nullptr ||
grpc_mdelem_static_value_eq(b->idx.named.status->md,
GRPC_MDELEM_STATUS_200)) {
grpc_metadata_batch_remove(b, b->idx.named.status);
grpc_metadata_batch_remove(b, GRPC_BATCH_STATUS);
} else {
char* val = grpc_dump_slice(GRPC_MDVALUE(b->idx.named.status->md),
GPR_DUMP_ASCII);
@ -167,7 +167,7 @@ static grpc_error* client_filter_incoming_metadata(grpc_call_element* elem,
gpr_free(val);
}
}
grpc_metadata_batch_remove(b, b->idx.named.content_type);
grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_TYPE);
}
return GRPC_ERROR_NONE;
@ -336,7 +336,7 @@ static grpc_error* update_path_for_get(grpc_call_element* elem,
static void remove_if_present(grpc_metadata_batch* batch,
grpc_metadata_batch_callouts_index idx) {
if (batch->idx.array[idx] != nullptr) {
grpc_metadata_batch_remove(batch, batch->idx.array[idx]);
grpc_metadata_batch_remove(batch, idx);
}
}
@ -433,23 +433,25 @@ static void hc_start_transport_stream_op_batch(
layer headers. */
error = grpc_metadata_batch_add_head(
batch->payload->send_initial_metadata.send_initial_metadata,
&calld->method, method);
&calld->method, method, GRPC_BATCH_METHOD);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_head(
batch->payload->send_initial_metadata.send_initial_metadata,
&calld->scheme, channeld->static_scheme);
&calld->scheme, channeld->static_scheme, GRPC_BATCH_SCHEME);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_tail(
batch->payload->send_initial_metadata.send_initial_metadata,
&calld->te_trailers, GRPC_MDELEM_TE_TRAILERS);
&calld->te_trailers, GRPC_MDELEM_TE_TRAILERS, GRPC_BATCH_TE);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_tail(
batch->payload->send_initial_metadata.send_initial_metadata,
&calld->content_type, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC);
&calld->content_type, GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
GRPC_BATCH_CONTENT_TYPE);
if (error != GRPC_ERROR_NONE) goto done;
error = grpc_metadata_batch_add_tail(
batch->payload->send_initial_metadata.send_initial_metadata,
&calld->user_agent, GRPC_MDELEM_REF(channeld->user_agent));
&calld->user_agent, GRPC_MDELEM_REF(channeld->user_agent),
GRPC_BATCH_USER_AGENT);
if (error != GRPC_ERROR_NONE) goto done;
}

@ -60,7 +60,7 @@ void authority_start_transport_stream_op_batch(
initial_metadata->idx.named.authority == nullptr) {
grpc_error* error = grpc_metadata_batch_add_head(
initial_metadata, &calld->authority_storage,
GRPC_MDELEM_REF(chand->default_authority_mdelem));
GRPC_MDELEM_REF(chand->default_authority_mdelem), GRPC_BATCH_AUTHORITY);
if (error != GRPC_ERROR_NONE) {
grpc_transport_stream_op_batch_finish_with_failure(batch, error,
calld->call_combiner);

@ -137,9 +137,8 @@ static grpc_compression_algorithm find_compression_algorithm(
&compression_algorithm));
// Remove this metadata since it's an internal one (i.e., it won't be
// transmitted out).
grpc_metadata_batch_remove(
initial_metadata,
initial_metadata->idx.named.grpc_internal_encoding_request);
grpc_metadata_batch_remove(initial_metadata,
GRPC_BATCH_GRPC_INTERNAL_ENCODING_REQUEST);
// Check if that algorithm is enabled. Note that GRPC_COMPRESS_NONE is always
// enabled.
// TODO(juanlishen): Maybe use channel default or abort() if the algorithm
@ -195,19 +194,22 @@ static grpc_error* process_send_initial_metadata(
error = grpc_metadata_batch_add_tail(
initial_metadata, &calld->message_compression_algorithm_storage,
grpc_message_compression_encoding_mdelem(
calld->message_compression_algorithm));
calld->message_compression_algorithm),
GRPC_BATCH_GRPC_ENCODING);
} else if (stream_compression_algorithm != GRPC_STREAM_COMPRESS_NONE) {
initialize_state(elem, calld);
error = grpc_metadata_batch_add_tail(
initial_metadata, &calld->stream_compression_algorithm_storage,
grpc_stream_compression_encoding_mdelem(stream_compression_algorithm));
grpc_stream_compression_encoding_mdelem(stream_compression_algorithm),
GRPC_BATCH_CONTENT_ENCODING);
}
if (error != GRPC_ERROR_NONE) return error;
// Convey supported compression algorithms.
error = grpc_metadata_batch_add_tail(
initial_metadata, &calld->accept_encoding_storage,
GRPC_MDELEM_ACCEPT_ENCODING_FOR_ALGORITHMS(
channeld->enabled_message_compression_algorithms_bitset));
channeld->enabled_message_compression_algorithms_bitset),
GRPC_BATCH_GRPC_ACCEPT_ENCODING);
if (error != GRPC_ERROR_NONE) return error;
// Do not overwrite accept-encoding header if it already presents (e.g., added
// by some proxy).
@ -215,7 +217,8 @@ static grpc_error* process_send_initial_metadata(
error = grpc_metadata_batch_add_tail(
initial_metadata, &calld->accept_stream_encoding_storage,
GRPC_MDELEM_ACCEPT_STREAM_ENCODING_FOR_ALGORITHMS(
channeld->enabled_stream_compression_algorithms_bitset));
channeld->enabled_stream_compression_algorithms_bitset),
GRPC_BATCH_ACCEPT_ENCODING);
}
return error;
}

@ -124,6 +124,32 @@ static void hs_add_error(const char* error_name, grpc_error** cumulative,
*cumulative = grpc_error_add_child(*cumulative, new_err);
}
// Metadata equality within this filter leverages the fact that the sender was
// likely using the gRPC chttp2 transport, in which case the encoder would emit
// indexed values, in which case the local hpack parser would intern the
// relevant metadata, allowing a simple pointer comparison.
//
// That said, if the header was transmitted sans indexing/encoding, we still
// need to do the right thing.
//
// Assumptions:
// 1) The keys for a and b_static must match
// 2) b_static must be a statically allocated metadata object.
// 3) It is assumed that the remote end is indexing, but not necessary.
// TODO(arjunroy): Revisit this method when grpc_mdelem is strongly typed.
static bool md_strict_equal(grpc_mdelem a, grpc_mdelem b_static) {
// Hpack encoder on the remote side should emit indexed values, in which case
// hpack parser on this end should pick up interned values, in which case the
// pointer comparison alone is enough.
//
if (GPR_LIKELY(GRPC_MDELEM_IS_INTERNED(a))) {
return a.payload == b_static.payload;
} else {
return grpc_slice_eq_static_interned(GRPC_MDVALUE(a),
GRPC_MDVALUE(b_static));
}
}
static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
grpc_metadata_batch* b) {
call_data* calld = static_cast<call_data*>(elem->call_data);
@ -131,19 +157,18 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
static const char* error_name = "Failed processing incoming headers";
if (b->idx.named.method != nullptr) {
if (grpc_mdelem_static_value_eq(b->idx.named.method->md,
GRPC_MDELEM_METHOD_POST)) {
if (md_strict_equal(b->idx.named.method->md, GRPC_MDELEM_METHOD_POST)) {
*calld->recv_initial_metadata_flags &=
~(GRPC_INITIAL_METADATA_CACHEABLE_REQUEST |
GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST);
} else if (grpc_mdelem_static_value_eq(b->idx.named.method->md,
GRPC_MDELEM_METHOD_PUT)) {
} else if (md_strict_equal(b->idx.named.method->md,
GRPC_MDELEM_METHOD_PUT)) {
*calld->recv_initial_metadata_flags &=
~GRPC_INITIAL_METADATA_CACHEABLE_REQUEST;
*calld->recv_initial_metadata_flags |=
GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST;
} else if (grpc_mdelem_static_value_eq(b->idx.named.method->md,
GRPC_MDELEM_METHOD_GET)) {
} else if (md_strict_equal(b->idx.named.method->md,
GRPC_MDELEM_METHOD_GET)) {
*calld->recv_initial_metadata_flags |=
GRPC_INITIAL_METADATA_CACHEABLE_REQUEST;
*calld->recv_initial_metadata_flags &=
@ -154,7 +179,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
b->idx.named.method->md));
}
grpc_metadata_batch_remove(b, b->idx.named.method);
grpc_metadata_batch_remove(b, GRPC_BATCH_METHOD);
} else {
hs_add_error(
error_name, &error,
@ -171,7 +196,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
b->idx.named.te->md));
}
grpc_metadata_batch_remove(b, b->idx.named.te);
grpc_metadata_batch_remove(b, GRPC_BATCH_TE);
} else {
hs_add_error(error_name, &error,
grpc_error_set_str(
@ -180,10 +205,8 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
}
if (b->idx.named.scheme != nullptr) {
if (!grpc_mdelem_static_value_eq(b->idx.named.scheme->md,
GRPC_MDELEM_SCHEME_HTTP) &&
!grpc_mdelem_static_value_eq(b->idx.named.scheme->md,
GRPC_MDELEM_SCHEME_HTTPS) &&
if (!md_strict_equal(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTP) &&
!md_strict_equal(b->idx.named.scheme->md, GRPC_MDELEM_SCHEME_HTTPS) &&
!grpc_mdelem_static_value_eq(b->idx.named.scheme->md,
GRPC_MDELEM_SCHEME_GRPC)) {
hs_add_error(error_name, &error,
@ -191,7 +214,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Bad header"),
b->idx.named.scheme->md));
}
grpc_metadata_batch_remove(b, b->idx.named.scheme);
grpc_metadata_batch_remove(b, GRPC_BATCH_SCHEME);
} else {
hs_add_error(
error_name, &error,
@ -227,7 +250,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
gpr_free(val);
}
}
grpc_metadata_batch_remove(b, b->idx.named.content_type);
grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_TYPE);
}
if (b->idx.named.path == nullptr) {
@ -282,12 +305,13 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
grpc_linked_mdelem* el = b->idx.named.host;
grpc_mdelem md = GRPC_MDELEM_REF(el->md);
grpc_metadata_batch_remove(b, el);
hs_add_error(error_name, &error,
grpc_metadata_batch_add_head(
b, el,
grpc_mdelem_from_slices(
GRPC_MDSTR_AUTHORITY,
grpc_slice_ref_internal(GRPC_MDVALUE(md)))));
hs_add_error(
error_name, &error,
grpc_metadata_batch_add_head(
b, el,
grpc_mdelem_from_slices(GRPC_MDSTR_AUTHORITY,
grpc_slice_ref_internal(GRPC_MDVALUE(md))),
GRPC_BATCH_AUTHORITY));
GRPC_MDELEM_UNREF(md);
}
@ -301,7 +325,7 @@ static grpc_error* hs_filter_incoming_metadata(grpc_call_element* elem,
channel_data* chand = static_cast<channel_data*>(elem->channel_data);
if (!chand->surface_user_agent && b->idx.named.user_agent != nullptr) {
grpc_metadata_batch_remove(b, b->idx.named.user_agent);
grpc_metadata_batch_remove(b, GRPC_BATCH_USER_AGENT);
}
return error;
@ -392,15 +416,17 @@ static grpc_error* hs_mutate_op(grpc_call_element* elem,
if (op->send_initial_metadata) {
grpc_error* error = GRPC_ERROR_NONE;
static const char* error_name = "Failed sending initial metadata";
hs_add_error(error_name, &error,
grpc_metadata_batch_add_head(
op->payload->send_initial_metadata.send_initial_metadata,
&calld->status, GRPC_MDELEM_STATUS_200));
hs_add_error(
error_name, &error,
grpc_metadata_batch_add_head(
op->payload->send_initial_metadata.send_initial_metadata,
&calld->status, GRPC_MDELEM_STATUS_200, GRPC_BATCH_STATUS));
hs_add_error(error_name, &error,
grpc_metadata_batch_add_tail(
op->payload->send_initial_metadata.send_initial_metadata,
&calld->content_type,
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC));
GRPC_MDELEM_CONTENT_TYPE_APPLICATION_SLASH_GRPC,
GRPC_BATCH_CONTENT_TYPE));
hs_add_error(
error_name, &error,
hs_filter_outgoing_metadata(

@ -74,6 +74,8 @@
#define DEFAULT_MAX_PINGS_BETWEEN_DATA 2
#define DEFAULT_MAX_PING_STRIKES 2
#define DEFAULT_MAX_PENDING_INDUCED_FRAMES 10000
static int g_default_client_keepalive_time_ms =
DEFAULT_CLIENT_KEEPALIVE_TIME_MS;
static int g_default_client_keepalive_timeout_ms =
@ -105,6 +107,7 @@ static void write_action(void* t, grpc_error* error);
static void write_action_end_locked(void* t, grpc_error* error);
static void read_action_locked(void* t, grpc_error* error);
static void continue_read_action_locked(grpc_chttp2_transport* t);
static void complete_fetch_locked(void* gs, grpc_error* error);
/** Set a transport level setting, and push it to our peer */
@ -797,10 +800,8 @@ grpc_chttp2_stream* grpc_chttp2_parsing_accept_stream(grpc_chttp2_transport* t,
!grpc_resource_user_safe_alloc(t->resource_user,
GRPC_RESOURCE_QUOTA_CALL_SIZE)) {
gpr_log(GPR_ERROR, "Memory exhausted, rejecting the stream.");
grpc_slice_buffer_add(
&t->qbuf,
grpc_chttp2_rst_stream_create(
id, static_cast<uint32_t>(GRPC_HTTP2_REFUSED_STREAM), nullptr));
grpc_chttp2_add_rst_stream_to_next_write(t, id, GRPC_HTTP2_REFUSED_STREAM,
nullptr);
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
return nullptr;
}
@ -1045,6 +1046,19 @@ static void write_action_begin_locked(void* gt, grpc_error* error_ignored) {
GRPC_CLOSURE_SCHED(
GRPC_CLOSURE_INIT(&t->write_action, write_action, t, scheduler),
GRPC_ERROR_NONE);
if (t->reading_paused_on_pending_induced_frames) {
GPR_ASSERT(t->num_pending_induced_frames == 0);
/* We had paused reading, because we had many induced frames (SETTINGS
* ACK, PINGS ACK and RST_STREAMS) pending in t->qbuf. Now that we have
* been able to flush qbuf, we can resume reading. */
GRPC_CHTTP2_IF_TRACING(gpr_log(
GPR_INFO,
"transport %p : Resuming reading after being paused due to too "
"many unwritten SETTINGS ACK, PINGS ACK and RST_STREAM frames",
t));
t->reading_paused_on_pending_induced_frames = false;
continue_read_action_locked(t);
}
} else {
GRPC_STATS_INC_HTTP2_SPURIOUS_WRITES_BEGUN();
set_write_state(t, GRPC_CHTTP2_WRITE_STATE_IDLE, "begin writing nothing");
@ -1114,7 +1128,6 @@ static void write_action_end_locked(void* tp, grpc_error* error) {
}
grpc_chttp2_end_write(t, GRPC_ERROR_REF(error));
GRPC_CHTTP2_UNREF_TRANSPORT(t, "writing");
}
@ -1160,7 +1173,6 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
gpr_log(GPR_INFO, "%s: Got goaway [%d] err=%s", t->peer_string,
goaway_error, grpc_error_string(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
@ -1186,6 +1198,17 @@ void grpc_chttp2_add_incoming_goaway(grpc_chttp2_transport* t,
static void maybe_start_some_streams(grpc_chttp2_transport* t) {
grpc_chttp2_stream* s;
/* cancel out streams that haven't yet started if we have received a GOAWAY */
if (t->goaway_error != GRPC_ERROR_NONE) {
while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
grpc_chttp2_cancel_stream(
t, s,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("GOAWAY received"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
}
return;
}
/* start streams where we have free grpc_chttp2_stream ids and free
* concurrency */
while (t->next_stream_id <= MAX_CLIENT_STREAM_ID &&
@ -1214,13 +1237,14 @@ static void maybe_start_some_streams(grpc_chttp2_transport* t) {
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_START_NEW_STREAM);
}
/* cancel out streams that will never be started */
while (t->next_stream_id >= MAX_CLIENT_STREAM_ID &&
grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
grpc_chttp2_cancel_stream(
t, s,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
if (t->next_stream_id >= MAX_CLIENT_STREAM_ID) {
while (grpc_chttp2_list_pop_waiting_for_concurrency(t, &s)) {
grpc_chttp2_cancel_stream(
t, s,
grpc_error_set_int(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Stream IDs exhausted"),
GRPC_ERROR_INT_GRPC_STATUS, GRPC_STATUS_UNAVAILABLE));
}
}
}
@ -2110,10 +2134,8 @@ void grpc_chttp2_cancel_stream(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_http2_error_code http_error;
grpc_error_get_status(due_to_error, s->deadline, nullptr, nullptr,
&http_error, nullptr);
grpc_slice_buffer_add(
&t->qbuf,
grpc_chttp2_rst_stream_create(
s->id, static_cast<uint32_t>(http_error), &s->stats.outgoing));
grpc_chttp2_add_rst_stream_to_next_write(
t, s->id, static_cast<uint32_t>(http_error), &s->stats.outgoing);
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_RST_STREAM);
}
}
@ -2424,9 +2446,8 @@ static void close_from_api(grpc_chttp2_transport* t, grpc_chttp2_stream* s,
grpc_slice_buffer_add(&t->qbuf, status_hdr);
grpc_slice_buffer_add(&t->qbuf, message_pfx);
grpc_slice_buffer_add(&t->qbuf, grpc_slice_ref_internal(slice));
grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR,
&s->stats.outgoing));
grpc_chttp2_add_rst_stream_to_next_write(t, s->id, GRPC_HTTP2_NO_ERROR,
&s->stats.outgoing);
grpc_chttp2_mark_stream_closed(t, s, 1, 1, error);
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_CLOSE_FROM_API);
@ -2596,10 +2617,16 @@ static void read_action_locked(void* tp, grpc_error* error) {
grpc_slice_buffer_reset_and_unref_internal(&t->read_buffer);
if (keep_reading) {
const bool urgent = t->goaway_error != GRPC_ERROR_NONE;
grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent);
grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t,
nullptr);
if (t->num_pending_induced_frames >= DEFAULT_MAX_PENDING_INDUCED_FRAMES) {
t->reading_paused_on_pending_induced_frames = true;
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_INFO,
"transport %p : Pausing reading due to too "
"many unwritten SETTINGS ACK and RST_STREAM frames",
t));
} else {
continue_read_action_locked(t);
}
} else {
GRPC_CHTTP2_UNREF_TRANSPORT(t, "reading_action");
}
@ -2607,6 +2634,12 @@ static void read_action_locked(void* tp, grpc_error* error) {
GRPC_ERROR_UNREF(error);
}
static void continue_read_action_locked(grpc_chttp2_transport* t) {
const bool urgent = t->goaway_error != GRPC_ERROR_NONE;
grpc_endpoint_read(t->ep, &t->read_buffer, &t->read_action_locked, urgent);
grpc_chttp2_act_on_flowctl_action(t->flow_control->MakeAction(), t, nullptr);
}
// t is reffed prior to calling the first time, and once the callback chain
// that kicks off finishes, it's unreffed
static void schedule_bdp_ping_locked(grpc_chttp2_transport* t) {

@ -118,6 +118,7 @@ grpc_error* grpc_chttp2_ping_parser_parse(void* parser,
t->ping_acks = static_cast<uint64_t*>(gpr_realloc(
t->ping_acks, t->ping_ack_capacity * sizeof(*t->ping_acks)));
}
t->num_pending_induced_frames++;
t->ping_acks[t->ping_ack_count++] = p->opaque_8bytes;
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_PING_RESPONSE);
}

@ -58,6 +58,14 @@ grpc_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
return slice;
}
void grpc_chttp2_add_rst_stream_to_next_write(
grpc_chttp2_transport* t, uint32_t id, uint32_t code,
grpc_transport_one_way_stats* stats) {
t->num_pending_induced_frames++;
grpc_slice_buffer_add(&t->qbuf,
grpc_chttp2_rst_stream_create(id, code, stats));
}
grpc_error* grpc_chttp2_rst_stream_parser_begin_frame(
grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags) {
if (length != 4) {

@ -33,6 +33,13 @@ typedef struct {
grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
grpc_transport_one_way_stats* stats);
// Adds RST_STREAM frame to t->qbuf (buffer for the next write). Should be
// called when we want to add RST_STREAM and we are not in
// write_action_begin_locked.
void grpc_chttp2_add_rst_stream_to_next_write(
grpc_chttp2_transport* t, uint32_t id, uint32_t code,
grpc_transport_one_way_stats* stats);
grpc_error* grpc_chttp2_rst_stream_parser_begin_frame(
grpc_chttp2_rst_stream_parser* parser, uint32_t length, uint8_t flags);
grpc_error* grpc_chttp2_rst_stream_parser_parse(void* parser,

@ -132,6 +132,7 @@ grpc_error* grpc_chttp2_settings_parser_parse(void* p, grpc_chttp2_transport* t,
if (is_last) {
memcpy(parser->target_settings, parser->incoming_settings,
GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t));
t->num_pending_induced_frames++;
grpc_slice_buffer_add(&t->qbuf, grpc_chttp2_settings_ack_create());
if (t->notify_on_receive_settings != nullptr) {
GRPC_CLOSURE_SCHED(t->notify_on_receive_settings,

@ -1671,9 +1671,8 @@ static void force_client_rst_stream(void* sp, grpc_error* error) {
grpc_chttp2_stream* s = static_cast<grpc_chttp2_stream*>(sp);
grpc_chttp2_transport* t = s->t;
if (!s->write_closed) {
grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_HTTP2_NO_ERROR,
&s->stats.outgoing));
grpc_chttp2_add_rst_stream_to_next_write(t, s->id, GRPC_HTTP2_NO_ERROR,
&s->stats.outgoing);
grpc_chttp2_initiate_write(t, GRPC_CHTTP2_INITIATE_WRITE_FORCE_RST_STREAM);
grpc_chttp2_mark_stream_closed(t, s, true, true, GRPC_ERROR_NONE);
}

@ -493,6 +493,13 @@ struct grpc_chttp2_transport {
grpc_core::ContextList* cl = nullptr;
grpc_core::RefCountedPtr<grpc_core::channelz::SocketNode> channelz_socket;
uint32_t num_messages_in_next_write = 0;
/** The number of pending induced frames (SETTINGS_ACK, PINGS_ACK and
* RST_STREAM) in the outgoing buffer (t->qbuf). If this number goes beyond
* DEFAULT_MAX_PENDING_INDUCED_FRAMES, we pause reading new frames. We would
* only continue reading when we are able to write to the socket again,
* thereby reducing the number of induced frames. */
uint32_t num_pending_induced_frames = 0;
bool reading_paused_on_pending_induced_frames = false;
};
typedef enum {

@ -382,10 +382,9 @@ error_handler:
if (s != nullptr) {
grpc_chttp2_mark_stream_closed(t, s, true, false, err);
}
grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id,
GRPC_HTTP2_PROTOCOL_ERROR,
&s->stats.outgoing));
grpc_chttp2_add_rst_stream_to_next_write(t, t->incoming_stream_id,
GRPC_HTTP2_PROTOCOL_ERROR,
&s->stats.outgoing);
return init_skip_frame_parser(t, 0);
} else {
return err;
@ -763,10 +762,9 @@ static grpc_error* parse_frame_slice(grpc_chttp2_transport* t,
grpc_chttp2_parsing_become_skip_parser(t);
if (s) {
s->forced_close_error = err;
grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id,
GRPC_HTTP2_PROTOCOL_ERROR,
&s->stats.outgoing));
grpc_chttp2_add_rst_stream_to_next_write(t, t->incoming_stream_id,
GRPC_HTTP2_PROTOCOL_ERROR,
&s->stats.outgoing);
} else {
GRPC_ERROR_UNREF(err);
}

@ -219,6 +219,7 @@ class WriteContext {
void FlushQueuedBuffers() {
/* simple writes are queued to qbuf, and flushed here */
grpc_slice_buffer_move_into(&t_->qbuf, &t_->outbuf);
t_->num_pending_induced_frames = 0;
GPR_ASSERT(t_->qbuf.count == 0);
}

@ -40,6 +40,7 @@
#include "src/core/lib/surface/validate_metadata.h"
#include "src/core/lib/transport/metadata_batch.h"
#include "src/core/lib/transport/static_metadata.h"
#include "src/core/lib/transport/timeout_encoding.h"
#include "src/core/lib/transport/transport_impl.h"
#include "third_party/objective_c/Cronet/bidirectional_stream_c.h"
@ -718,16 +719,20 @@ static void create_grpc_frame(grpc_slice_buffer* write_slice_buffer,
Convert metadata in a format that Cronet can consume
*/
static void convert_metadata_to_cronet_headers(
grpc_linked_mdelem* head, const char* host, char** pp_url,
grpc_metadata_batch* metadata, const char* host, char** pp_url,
bidirectional_stream_header** pp_headers, size_t* p_num_headers,
const char** method) {
grpc_linked_mdelem* curr = head;
grpc_linked_mdelem* curr = metadata->list.head;
/* Walk the linked list and get number of header fields */
size_t num_headers_available = 0;
while (curr != nullptr) {
curr = curr->next;
num_headers_available++;
}
grpc_millis deadline = metadata->deadline;
if (deadline != GRPC_MILLIS_INF_FUTURE) {
num_headers_available++;
}
/* Allocate enough memory. It is freed in the on_stream_ready callback
*/
bidirectional_stream_header* headers =
@ -740,7 +745,7 @@ static void convert_metadata_to_cronet_headers(
are not used for cronet.
TODO (makdharma): Eliminate need to traverse the LL second time for perf.
*/
curr = head;
curr = metadata->list.head;
size_t num_headers = 0;
while (num_headers < num_headers_available) {
grpc_mdelem mdelem = curr->md;
@ -788,6 +793,18 @@ static void convert_metadata_to_cronet_headers(
break;
}
}
if (deadline != GRPC_MILLIS_INF_FUTURE) {
char* key = grpc_slice_to_c_string(GRPC_MDSTR_GRPC_TIMEOUT);
char* value =
static_cast<char*>(gpr_malloc(GRPC_HTTP2_TIMEOUT_ENCODE_MIN_BUFSIZE));
grpc_http2_encode_timeout(deadline - grpc_core::ExecCtx::Get()->Now(),
value);
headers[num_headers].key = key;
headers[num_headers].value = value;
num_headers++;
}
*p_num_headers = num_headers;
}
@ -1028,10 +1045,10 @@ static enum e_op_result execute_stream_op(struct op_and_state* oas) {
char* url = nullptr;
const char* method = "POST";
s->header_array.headers = nullptr;
convert_metadata_to_cronet_headers(stream_op->payload->send_initial_metadata
.send_initial_metadata->list.head,
t->host, &url, &s->header_array.headers,
&s->header_array.count, &method);
convert_metadata_to_cronet_headers(
stream_op->payload->send_initial_metadata.send_initial_metadata,
t->host, &url, &s->header_array.headers, &s->header_array.count,
&method);
s->header_array.capacity = s->header_array.count;
CRONET_LOG(GPR_DEBUG, "bidirectional_stream_start(%p, %s)", s->cbs, url);
bidirectional_stream_start(s->cbs, url, 0, method, &s->header_array, false);

@ -257,6 +257,13 @@ int grpc_channel_arg_get_integer(const grpc_arg* arg,
return arg->value.integer;
}
int grpc_channel_args_find_integer(const grpc_channel_args* args,
const char* name,
const grpc_integer_options options) {
const grpc_arg* arg = grpc_channel_args_find(args, name);
return grpc_channel_arg_get_integer(arg, options);
}
char* grpc_channel_arg_get_string(const grpc_arg* arg) {
if (arg == nullptr) return nullptr;
if (arg->type != GRPC_ARG_STRING) {
@ -266,6 +273,12 @@ char* grpc_channel_arg_get_string(const grpc_arg* arg) {
return arg->value.string;
}
char* grpc_channel_args_find_string(const grpc_channel_args* args,
const char* name) {
const grpc_arg* arg = grpc_channel_args_find(args, name);
return grpc_channel_arg_get_string(arg);
}
bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value) {
if (arg == nullptr) return default_value;
if (arg->type != GRPC_ARG_INTEGER) {
@ -284,6 +297,12 @@ bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value) {
}
}
bool grpc_channel_args_find_bool(const grpc_channel_args* args,
const char* name, bool default_value) {
const grpc_arg* arg = grpc_channel_args_find(args, name);
return grpc_channel_arg_get_bool(arg, default_value);
}
bool grpc_channel_args_want_minimal_stack(const grpc_channel_args* args) {
return grpc_channel_arg_get_bool(
grpc_channel_args_find(args, GRPC_ARG_MINIMAL_STACK), false);

@ -73,16 +73,30 @@ typedef struct grpc_integer_options {
int max_value;
} grpc_integer_options;
/** Returns the value of \a arg, subject to the contraints in \a options. */
/** Returns the value of \a arg, subject to the constraints in \a options. */
int grpc_channel_arg_get_integer(const grpc_arg* arg,
const grpc_integer_options options);
/** Similar to the above, but needs to find the arg from \a args by the name
* first. */
int grpc_channel_args_find_integer(const grpc_channel_args* args,
const char* name,
const grpc_integer_options options);
/** Returns the value of \a arg if \a arg is of type GRPC_ARG_STRING.
Otherwise, emits a warning log, and returns nullptr.
If arg is nullptr, returns nullptr, and does not emit a warning. */
char* grpc_channel_arg_get_string(const grpc_arg* arg);
/** Similar to the above, but needs to find the arg from \a args by the name
* first. */
char* grpc_channel_args_find_string(const grpc_channel_args* args,
const char* name);
/** If \a arg is of type GRPC_ARG_INTEGER, returns true if it's non-zero.
* Returns \a default_value if \a arg is of other types. */
bool grpc_channel_arg_get_bool(const grpc_arg* arg, bool default_value);
/** Similar to the above, but needs to find the arg from \a args by the name
* first. */
bool grpc_channel_args_find_bool(const grpc_channel_args* args,
const char* name, bool default_value);
// Helpers for creating channel args.
grpc_arg grpc_channel_arg_string_create(char* name, char* value);

@ -37,14 +37,15 @@ struct StringLess {
bool operator()(const char* a, const char* b) const {
return strcmp(a, b) < 0;
}
bool operator()(const UniquePtr<char>& k1, const UniquePtr<char>& k2) {
bool operator()(const UniquePtr<char>& k1, const UniquePtr<char>& k2) const {
return strcmp(k1.get(), k2.get()) < 0;
}
};
template <typename T>
struct RefCountedPtrLess {
bool operator()(const RefCountedPtr<T>& p1, const RefCountedPtr<T>& p2) {
bool operator()(const RefCountedPtr<T>& p1,
const RefCountedPtr<T>& p2) const {
return p1.get() < p2.get();
}
};
@ -117,7 +118,11 @@ class Map {
iterator end() { return iterator(this, nullptr); }
iterator lower_bound(const Key& k) {
key_compare compare;
// This is a workaround for "const key_compare compare;"
// because some versions of compilers cannot build this by requiring
// a user-provided constructor. (ref: https://stackoverflow.com/q/7411515)
key_compare compare_tmp;
const key_compare& compare = compare_tmp;
return std::find_if(begin(), end(), [&k, &compare](const value_type& v) {
return !compare(v.first, k);
});
@ -448,7 +453,11 @@ Map<Key, T, Compare>::RemoveRecursive(Entry* root, const key_type& k) {
template <class Key, class T, class Compare>
int Map<Key, T, Compare>::CompareKeys(const key_type& lhs,
const key_type& rhs) {
key_compare compare;
// This is a workaround for "const key_compare compare;"
// because some versions of compilers cannot build this by requiring
// a user-provided constructor. (ref: https://stackoverflow.com/q/7411515)
key_compare compare_tmp;
const key_compare& compare = compare_tmp;
bool left_comparison = compare(lhs, rhs);
bool right_comparison = compare(rhs, lhs);
// Both values are equal

@ -18,6 +18,8 @@
#include <grpc/support/port_platform.h>
#include "src/core/lib/iomgr/timer_manager.h"
#include <inttypes.h>
#include <grpc/support/alloc.h>
@ -26,7 +28,6 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/gprpp/thd.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/iomgr/timer_manager.h"
struct completed_thread {
grpc_core::Thread thd;
@ -58,6 +59,8 @@ static bool g_has_timed_waiter;
static grpc_millis g_timed_waiter_deadline;
// generation counter to track which thread is waiting for the next timer
static uint64_t g_timed_waiter_generation;
// number of timer wakeups
static uint64_t g_wakeups;
static void timer_thread(void* completed_thread_ptr);
@ -206,6 +209,7 @@ static bool wait_until(grpc_millis next) {
// that there's now no timed waiter... we'll look for a replacement if
// there's work to do after checking timers (code above)
if (my_timed_waiter_generation == g_timed_waiter_generation) {
++g_wakeups;
g_has_timed_waiter = false;
g_timed_waiter_deadline = GRPC_MILLIS_INF_FUTURE;
}
@ -326,6 +330,7 @@ static void stop_threads(void) {
gc_completed_threads();
}
}
g_wakeups = 0;
gpr_mu_unlock(&g_mu);
}
@ -354,3 +359,5 @@ void grpc_kick_poller(void) {
gpr_cv_signal(&g_cv_wait);
gpr_mu_unlock(&g_mu);
}
uint64_t grpc_timer_manager_get_wakeups_testonly(void) { return g_wakeups; }

@ -35,5 +35,7 @@ void grpc_timer_manager_set_threading(bool enabled);
/* explicitly perform one tick of the timer system - for when threading is
* disabled */
void grpc_timer_manager_tick(void);
/* get global counter that tracks timer wakeups */
uint64_t grpc_timer_manager_get_wakeups_testonly(void);
#endif /* GRPC_CORE_LIB_IOMGR_TIMER_MANAGER_H */

@ -1007,13 +1007,13 @@ static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) {
GPR_TIMER_SCOPE("incoming_stream_compression_algorithm", 0);
set_incoming_stream_compression_algorithm(
call, decode_stream_compression(b->idx.named.content_encoding->md));
grpc_metadata_batch_remove(b, b->idx.named.content_encoding);
grpc_metadata_batch_remove(b, GRPC_BATCH_CONTENT_ENCODING);
}
if (b->idx.named.grpc_encoding != nullptr) {
GPR_TIMER_SCOPE("incoming_message_compression_algorithm", 0);
set_incoming_message_compression_algorithm(
call, decode_message_compression(b->idx.named.grpc_encoding->md));
grpc_metadata_batch_remove(b, b->idx.named.grpc_encoding);
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_ENCODING);
}
uint32_t message_encodings_accepted_by_peer = 1u;
uint32_t stream_encodings_accepted_by_peer = 1u;
@ -1021,13 +1021,13 @@ static void recv_initial_filter(grpc_call* call, grpc_metadata_batch* b) {
GPR_TIMER_SCOPE("encodings_accepted_by_peer", 0);
set_encodings_accepted_by_peer(call, b->idx.named.grpc_accept_encoding->md,
&message_encodings_accepted_by_peer, false);
grpc_metadata_batch_remove(b, b->idx.named.grpc_accept_encoding);
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_ACCEPT_ENCODING);
}
if (b->idx.named.accept_encoding != nullptr) {
GPR_TIMER_SCOPE("stream_encodings_accepted_by_peer", 0);
set_encodings_accepted_by_peer(call, b->idx.named.accept_encoding->md,
&stream_encodings_accepted_by_peer, true);
grpc_metadata_batch_remove(b, b->idx.named.accept_encoding);
grpc_metadata_batch_remove(b, GRPC_BATCH_ACCEPT_ENCODING);
}
call->encodings_accepted_by_peer =
grpc_compression_bitset_from_message_stream_compression_bitset(
@ -1059,13 +1059,13 @@ static void recv_trailing_filter(void* args, grpc_metadata_batch* b,
error = grpc_error_set_str(
error, GRPC_ERROR_STR_GRPC_MESSAGE,
grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_message->md)));
grpc_metadata_batch_remove(b, b->idx.named.grpc_message);
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_MESSAGE);
} else if (error != GRPC_ERROR_NONE) {
error = grpc_error_set_str(error, GRPC_ERROR_STR_GRPC_MESSAGE,
grpc_empty_slice());
}
set_final_status(call, GRPC_ERROR_REF(error));
grpc_metadata_batch_remove(b, b->idx.named.grpc_status);
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_STATUS);
GRPC_ERROR_UNREF(error);
} else if (!call->is_client) {
set_final_status(call, GRPC_ERROR_NONE);

@ -744,19 +744,18 @@ static void server_on_recv_initial_metadata(void* ptr, grpc_error* error) {
grpc_millis op_deadline;
if (error == GRPC_ERROR_NONE) {
GPR_ASSERT(calld->recv_initial_metadata->idx.named.path != nullptr);
GPR_ASSERT(calld->recv_initial_metadata->idx.named.authority != nullptr);
GPR_DEBUG_ASSERT(calld->recv_initial_metadata->idx.named.path != nullptr);
GPR_DEBUG_ASSERT(calld->recv_initial_metadata->idx.named.authority !=
nullptr);
calld->path = grpc_slice_ref_internal(
GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.path->md));
calld->host = grpc_slice_ref_internal(
GRPC_MDVALUE(calld->recv_initial_metadata->idx.named.authority->md));
calld->path_set = true;
calld->host_set = true;
grpc_metadata_batch_remove(calld->recv_initial_metadata, GRPC_BATCH_PATH);
grpc_metadata_batch_remove(calld->recv_initial_metadata,
calld->recv_initial_metadata->idx.named.path);
grpc_metadata_batch_remove(
calld->recv_initial_metadata,
calld->recv_initial_metadata->idx.named.authority);
GRPC_BATCH_AUTHORITY);
} else {
GRPC_ERROR_REF(error);
}

@ -93,6 +93,23 @@ grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md) {
return out;
}
static grpc_error* GPR_ATTRIBUTE_NOINLINE error_with_md(grpc_mdelem md) {
return grpc_attach_md_to_error(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unallowed duplicate metadata"), md);
}
static grpc_error* link_callout(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) {
GPR_DEBUG_ASSERT(idx >= 0 && idx < GRPC_BATCH_CALLOUTS_COUNT);
if (GPR_LIKELY(batch->idx.array[idx] == nullptr)) {
++batch->list.default_count;
batch->idx.array[idx] = storage;
return GRPC_ERROR_NONE;
}
return error_with_md(storage->md);
}
static grpc_error* maybe_link_callout(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage)
GRPC_MUST_USE_RESULT;
@ -104,14 +121,7 @@ static grpc_error* maybe_link_callout(grpc_metadata_batch* batch,
if (idx == GRPC_BATCH_CALLOUTS_COUNT) {
return GRPC_ERROR_NONE;
}
if (GPR_LIKELY(batch->idx.array[idx] == nullptr)) {
++batch->list.default_count;
batch->idx.array[idx] = storage;
return GRPC_ERROR_NONE;
}
return grpc_attach_md_to_error(
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Unallowed duplicate metadata"),
storage->md);
return link_callout(batch, storage, idx);
}
static void maybe_unlink_callout(grpc_metadata_batch* batch,
@ -122,21 +132,21 @@ static void maybe_unlink_callout(grpc_metadata_batch* batch,
return;
}
--batch->list.default_count;
GPR_ASSERT(batch->idx.array[idx] != nullptr);
GPR_DEBUG_ASSERT(batch->idx.array[idx] != nullptr);
batch->idx.array[idx] = nullptr;
}
grpc_error* grpc_metadata_batch_add_head(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage,
grpc_mdelem elem_to_add) {
GPR_ASSERT(!GRPC_MDISNULL(elem_to_add));
GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
storage->md = elem_to_add;
return grpc_metadata_batch_link_head(batch, storage);
}
static void link_head(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
assert_valid_list(list);
GPR_ASSERT(!GRPC_MDISNULL(storage->md));
GPR_DEBUG_ASSERT(!GRPC_MDISNULL(storage->md));
storage->prev = nullptr;
storage->next = list->head;
storage->reserved = nullptr;
@ -163,17 +173,35 @@ grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
return GRPC_ERROR_NONE;
}
// TODO(arjunroy): Need to revisit this and see what guarantees exist between
// C-core and the internal-metadata subsystem. E.g. can we ensure a particular
// metadata is never added twice, even in the presence of user supplied data?
grpc_error* grpc_metadata_batch_link_head(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) {
GPR_DEBUG_ASSERT(GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md)) == idx);
assert_valid_callouts(batch);
grpc_error* err = link_callout(batch, storage, idx);
if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) {
assert_valid_callouts(batch);
return err;
}
link_head(&batch->list, storage);
assert_valid_callouts(batch);
return GRPC_ERROR_NONE;
}
grpc_error* grpc_metadata_batch_add_tail(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage,
grpc_mdelem elem_to_add) {
GPR_ASSERT(!GRPC_MDISNULL(elem_to_add));
GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
storage->md = elem_to_add;
return grpc_metadata_batch_link_tail(batch, storage);
}
static void link_tail(grpc_mdelem_list* list, grpc_linked_mdelem* storage) {
assert_valid_list(list);
GPR_ASSERT(!GRPC_MDISNULL(storage->md));
GPR_DEBUG_ASSERT(!GRPC_MDISNULL(storage->md));
storage->prev = list->tail;
storage->next = nullptr;
storage->reserved = nullptr;
@ -200,6 +228,21 @@ grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch,
return GRPC_ERROR_NONE;
}
grpc_error* grpc_metadata_batch_link_tail(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) {
GPR_DEBUG_ASSERT(GRPC_BATCH_INDEX_OF(GRPC_MDKEY(storage->md)) == idx);
assert_valid_callouts(batch);
grpc_error* err = link_callout(batch, storage, idx);
if (GPR_UNLIKELY(err != GRPC_ERROR_NONE)) {
assert_valid_callouts(batch);
return err;
}
link_tail(&batch->list, storage);
assert_valid_callouts(batch);
return GRPC_ERROR_NONE;
}
static void unlink_storage(grpc_mdelem_list* list,
grpc_linked_mdelem* storage) {
assert_valid_list(list);
@ -226,6 +269,18 @@ void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
assert_valid_callouts(batch);
}
void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
grpc_metadata_batch_callouts_index idx) {
assert_valid_callouts(batch);
grpc_linked_mdelem* storage = batch->idx.array[idx];
GPR_DEBUG_ASSERT(storage != nullptr);
--batch->list.default_count;
batch->idx.array[idx] = nullptr;
unlink_storage(&batch->list, storage);
GRPC_MDELEM_UNREF(storage->md);
assert_valid_callouts(batch);
}
void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
const grpc_slice& value) {
grpc_mdelem old_mdelem = storage->md;
@ -313,13 +368,14 @@ void grpc_metadata_batch_copy(grpc_metadata_batch* src,
size_t i = 0;
for (grpc_linked_mdelem* elem = src->list.head; elem != nullptr;
elem = elem->next) {
grpc_error* error = grpc_metadata_batch_add_tail(dst, &storage[i++],
GRPC_MDELEM_REF(elem->md));
// Error unused in non-debug builds.
grpc_error* GRPC_UNUSED error = grpc_metadata_batch_add_tail(
dst, &storage[i++], GRPC_MDELEM_REF(elem->md));
// The only way that grpc_metadata_batch_add_tail() can fail is if
// there's a duplicate entry for a callout. However, that can't be
// the case here, because we would not have been allowed to create
// a source batch that had that kind of conflict.
GPR_ASSERT(error == GRPC_ERROR_NONE);
GPR_DEBUG_ASSERT(error == GRPC_ERROR_NONE);
}
}

@ -67,6 +67,8 @@ size_t grpc_metadata_batch_size(grpc_metadata_batch* batch);
/** Remove \a storage from the batch, unreffing the mdelem contained */
void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage);
void grpc_metadata_batch_remove(grpc_metadata_batch* batch,
grpc_metadata_batch_callouts_index idx);
/** Substitute a new mdelem for an old value */
grpc_error* grpc_metadata_batch_substitute(grpc_metadata_batch* batch,
@ -84,6 +86,9 @@ void grpc_metadata_batch_set_value(grpc_linked_mdelem* storage,
grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage)
GRPC_MUST_USE_RESULT;
grpc_error* grpc_metadata_batch_link_head(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) GRPC_MUST_USE_RESULT;
/** Add \a storage to the end of \a batch. storage->md is
assumed to be valid.
@ -93,6 +98,9 @@ grpc_error* grpc_metadata_batch_link_head(grpc_metadata_batch* batch,
grpc_error* grpc_metadata_batch_link_tail(grpc_metadata_batch* batch,
grpc_linked_mdelem* storage)
GRPC_MUST_USE_RESULT;
grpc_error* grpc_metadata_batch_link_tail(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) GRPC_MUST_USE_RESULT;
/** Add \a elem_to_add as the first element in \a batch, using
\a storage as backing storage for the linked list element.
@ -104,6 +112,22 @@ grpc_error* grpc_metadata_batch_add_head(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
// TODO(arjunroy, roth): Remove redundant methods.
// add/link_head/tail are almost identical.
inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) {
return grpc_metadata_batch_link_head(batch, storage, idx);
}
inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_head(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx) {
GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
storage->md = elem_to_add;
return grpc_metadata_batch_add_head(batch, storage, idx);
}
/** Add \a elem_to_add as the last element in \a batch, using
\a storage as backing storage for the linked list element.
\a storage is owned by the caller and must survive for the
@ -114,6 +138,20 @@ grpc_error* grpc_metadata_batch_add_tail(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_mdelem elem_to_add) GRPC_MUST_USE_RESULT;
inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_metadata_batch_callouts_index idx) {
return grpc_metadata_batch_link_tail(batch, storage, idx);
}
inline grpc_error* GRPC_MUST_USE_RESULT grpc_metadata_batch_add_tail(
grpc_metadata_batch* batch, grpc_linked_mdelem* storage,
grpc_mdelem elem_to_add, grpc_metadata_batch_callouts_index idx) {
GPR_DEBUG_ASSERT(!GRPC_MDISNULL(elem_to_add));
storage->md = elem_to_add;
return grpc_metadata_batch_add_tail(batch, storage, idx);
}
grpc_error* grpc_attach_md_to_error(grpc_error* src, grpc_mdelem md);
typedef struct {

@ -46,6 +46,8 @@ void grpc_resolver_dns_native_init(void);
void grpc_resolver_dns_native_shutdown(void);
void grpc_resolver_sockaddr_init(void);
void grpc_resolver_sockaddr_shutdown(void);
void grpc_resolver_xds_init(void);
void grpc_resolver_xds_shutdown(void);
void grpc_client_idle_filter_init(void);
void grpc_client_idle_filter_shutdown(void);
void grpc_max_age_filter_init(void);
@ -84,6 +86,8 @@ void grpc_register_built_in_plugins(void) {
grpc_resolver_dns_native_shutdown);
grpc_register_plugin(grpc_resolver_sockaddr_init,
grpc_resolver_sockaddr_shutdown);
grpc_register_plugin(grpc_resolver_xds_init,
grpc_resolver_xds_shutdown);
grpc_register_plugin(grpc_client_idle_filter_init,
grpc_client_idle_filter_shutdown);
grpc_register_plugin(grpc_max_age_filter_init,

@ -38,6 +38,8 @@ void grpc_resolver_sockaddr_init(void);
void grpc_resolver_sockaddr_shutdown(void);
void grpc_resolver_fake_init(void);
void grpc_resolver_fake_shutdown(void);
void grpc_resolver_xds_init(void);
void grpc_resolver_xds_shutdown(void);
void grpc_lb_policy_grpclb_init(void);
void grpc_lb_policy_grpclb_shutdown(void);
void grpc_lb_policy_xds_init(void);
@ -76,6 +78,8 @@ void grpc_register_built_in_plugins(void) {
grpc_resolver_sockaddr_shutdown);
grpc_register_plugin(grpc_resolver_fake_init,
grpc_resolver_fake_shutdown);
grpc_register_plugin(grpc_resolver_xds_init,
grpc_resolver_xds_shutdown);
grpc_register_plugin(grpc_lb_policy_grpclb_init,
grpc_lb_policy_grpclb_shutdown);
grpc_register_plugin(grpc_lb_policy_xds_init,

@ -94,7 +94,8 @@ void CensusClientCallData::StartTransportStreamOpBatch(
op->send_initial_metadata()->batch(), &tracing_bin_,
grpc_mdelem_from_slices(
GRPC_MDSTR_GRPC_TRACE_BIN,
grpc_core::UnmanagedMemorySlice(tracing_buf_, tracing_len))));
grpc_core::UnmanagedMemorySlice(tracing_buf_, tracing_len)),
GRPC_BATCH_GRPC_TRACE_BIN));
}
grpc_slice tags = grpc_empty_slice();
// TODO: Add in tagging serialization.
@ -104,7 +105,8 @@ void CensusClientCallData::StartTransportStreamOpBatch(
"census grpc_filter",
grpc_metadata_batch_add_tail(
op->send_initial_metadata()->batch(), &stats_bin_,
grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TAGS_BIN, tags)));
grpc_mdelem_from_slices(GRPC_MDSTR_GRPC_TAGS_BIN, tags),
GRPC_BATCH_GRPC_TAGS_BIN));
}
}

@ -50,12 +50,12 @@ void FilterInitialMetadata(grpc_metadata_batch* b,
if (b->idx.named.grpc_trace_bin != nullptr) {
sml->tracing_slice =
grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_trace_bin->md));
grpc_metadata_batch_remove(b, b->idx.named.grpc_trace_bin);
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_TRACE_BIN);
}
if (b->idx.named.grpc_tags_bin != nullptr) {
sml->census_proto =
grpc_slice_ref_internal(GRPC_MDVALUE(b->idx.named.grpc_tags_bin->md));
grpc_metadata_batch_remove(b, b->idx.named.grpc_tags_bin);
grpc_metadata_batch_remove(b, GRPC_BATCH_GRPC_TAGS_BIN);
}
}
@ -155,7 +155,8 @@ void CensusServerCallData::StartTransportStreamOpBatch(
op->send_trailing_metadata()->batch(), &census_bin_,
grpc_mdelem_from_slices(
GRPC_MDSTR_GRPC_SERVER_STATS_BIN,
grpc_core::UnmanagedMemorySlice(stats_buf_, len))));
grpc_core::UnmanagedMemorySlice(stats_buf_, len)),
GRPC_BATCH_GRPC_SERVER_STATS_BIN));
}
}
// Call next op.

@ -94,6 +94,7 @@ Pod::Spec.new do |s|
}
repo_root = '../..'
bazel = "#{repo_root}/tools/bazel"
plugin = 'grpc_cpp_plugin'
s.preserve_paths = plugin
@ -111,15 +112,6 @@ Pod::Spec.new do |s|
# present in this pod's directory. We use that knowledge to check for the existence of the file
# and, if absent, compile the plugin from the local sources.
s.prepare_command = <<-CMD
if [ ! -f #{plugin} ]; then
cd #{repo_root}
# This will build the plugin and put it in #{repo_root}/bins/opt.
#
# TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and
# library binary) if found, which _we do not want_. Find a way for this to always use the
# sources in the repo.
make #{plugin}
cd -
fi
#{bazel} build //src/compiler:grpc_cpp_plugin
CMD
end

@ -96,6 +96,7 @@ Pod::Spec.new do |s|
}
repo_root = '../..'
bazel = "#{repo_root}/tools/bazel"
plugin = 'grpc_objective_c_plugin'
s.preserve_paths = plugin
@ -115,15 +116,6 @@ Pod::Spec.new do |s|
# present in this pod's directory. We use that knowledge to check for the existence of the file
# and, if absent, compile the plugin from the local sources.
s.prepare_command = <<-CMD
if [ ! -f #{plugin} ]; then
cd #{repo_root}
# This will build the plugin and put it in #{repo_root}/bins/opt.
#
# TODO(jcanizales): I reckon make will try to use locally-installed libprotoc (headers and
# library binary) if found, which _we do not want_. Find a way for this to always use the
# sources in the repo.
make #{plugin}
cd -
fi
#{bazel} build //src/compiler:grpc_objective_c_plugin
CMD
end

@ -120,20 +120,9 @@ Pod::Spec.new do |s|
# present in this pod's directory. We use that knowledge to check for the existence of the file
# and, if absent, build it from the local sources.
repo_root = '../..'
plugin = 'grpc_objective_c_plugin'
bazel = "#{repo_root}/tools/bazel"
s.prepare_command = <<-CMD
if [ ! -f bin/protoc ]; then
cd #{repo_root}
# This will build protoc from the Protobuf submodule of gRPC, and put it in
# #{repo_root}/bins/opt/protobuf.
#
# TODO(jcanizales): Make won't build protoc from sources if one's locally installed, which
# _we do not want_. Find a way for this to always build from source.
make #{plugin}
cd -
else
mv bin/protoc .
mv include/google .
fi
#{bazel} build @com_google_protobuf//:protoc
CMD
end

@ -154,6 +154,7 @@ grpc_objc_library(
"ProtoRPC/ProtoService.h",
],
includes = ["."],
defines = ["GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS=0"],
deps = [
":grpc_objc_interface",
":proto_objc_rpc_legacy_header",
@ -189,3 +190,61 @@ apple_resource_bundle(
resources = ["//:etc/roots.pem"],
)
# Internal target combining grpc_objc_client_core and proto_objc_rpc for testing
grpc_objc_library(
name = "grpc_objc_client_core_internal_testing",
hdrs = [
"GRPCClient/GRPCCall+ChannelCredentials.h",
"GRPCClient/GRPCCall+Cronet.h",
"GRPCClient/GRPCCall+OAuth2.h",
"GRPCClient/GRPCCall+Tests.h",
"GRPCClient/GRPCCall+ChannelArg.h",
"GRPCClient/internal_testing/GRPCCall+InternalTests.h",
],
textual_hdrs = glob(["GRPCClient/private/GRPCCore/*.h"]),
srcs = [
"GRPCClient/GRPCCall+ChannelArg.m",
"GRPCClient/GRPCCall+ChannelCredentials.m",
"GRPCClient/GRPCCall+Cronet.m",
"GRPCClient/GRPCCall+OAuth2.m",
"GRPCClient/GRPCCall+Tests.m",
"GRPCClient/GRPCCallLegacy.m",
"GRPCClient/internal_testing/GRPCCall+InternalTests.m",
] + glob(["GRPCClient/private/GRPCCore/*.m"]),
data = [":gRPCCertificates"],
includes = ["."],
defines = [
"GRPC_TEST_OBJC=1",
],
deps = [
":grpc_objc_interface",
":grpc_objc_interface_legacy",
":rx_library",
"//:grpc_objc",
],
)
grpc_objc_library(
name = "proto_objc_rpc_internal_testing",
srcs = [
"ProtoRPC/ProtoRPCLegacy.m",
"ProtoRPC/ProtoServiceLegacy.m",
],
hdrs = [
"ProtoRPC/ProtoMethod.h",
"ProtoRPC/ProtoRPCLegacy.h",
"ProtoRPC/ProtoService.h",
],
deps = [
":rx_library",
":proto_objc_rpc_v2",
":proto_objc_rpc_legacy_header",
":grpc_objc_client_core_internal_testing",
"@com_google_protobuf//:protobuf_objc",
],
)
alias(
name = "grpc_objc_client_internal_testing",
actual = "proto_objc_rpc_internal_testing",
)

@ -17,6 +17,7 @@
*/
#ifdef GRPC_TEST_OBJC
#import <Foundation/Foundation.h>
/**
* Logs the op batches of a client. Used for testing.

@ -14,56 +14,159 @@
# See the License for the specific language governing permissions and
# limitations under the License.
licenses(["notice"]) # 3-clause BSD
package(default_visibility = ["//visibility:public"])
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load(
"@com_github_grpc_grpc//bazel:objc_grpc_library.bzl",
"objc_grpc_library",
"//src/objective-c:grpc_objc_internal_library.bzl",
"grpc_objc_examples_library",
"local_objc_grpc_library",
"proto_library_objc_wrapper",
)
load("@build_bazel_rules_apple//apple:ios.bzl", "ios_application")
load("@build_bazel_rules_apple//apple:tvos.bzl", "tvos_application")
load("@build_bazel_rules_apple//apple:watchos.bzl", "watchos_application", "watchos_extension")
proto_library(
proto_library_objc_wrapper(
name = "messages_proto",
srcs = ["BazelBuildSamples/messages.proto"],
visibility = ["//visibility:public"],
srcs = ["RemoteTestClient/messages.proto"],
)
objc_grpc_library(
name = "test_grpc_objc",
srcs = ["BazelBuildSamples/rmt/test.proto"],
proto_library_objc_wrapper(
name = "test_proto",
srcs = ["RemoteTestClient/test.proto"],
deps = [":messages_proto"],
use_well_known_protos = True,
)
# use objc_grpc_library in bazel:objc_grpc_library.bzl when developing outside the repo
local_objc_grpc_library(
name = "RemoteTest",
srcs = ["RemoteTestClient/test.proto"],
use_well_known_protos = True,
deps = [
"//src/objective-c/examples/BazelBuildSamples/rmt:test_proto",
"//src/objective-c/examples:test_proto",
],
)
# Proof that without this works without srcs
objc_grpc_library(
local_objc_grpc_library(
name = "test_objc",
use_well_known_protos = True,
deps = [
"//src/objective-c/examples/BazelBuildSamples/rmt:test_proto",
]
"//src/objective-c/examples:test_proto",
],
)
objc_library(
name = "ios-sample-lib",
srcs = glob(["BazelBuildSamples/ios-sample/ios-sample/**/*.m"]),
hdrs = glob(["BazelBuildSamples/ios-sample/ios-sample/**/*.h"]),
grpc_objc_examples_library(
name = "Sample-lib",
srcs = glob(["Sample/Sample/**/*.m"]),
hdrs = glob(["Sample/Sample/**/*.h"]),
data = glob([
"BazelBuildSamples/ios-sample/ios-sample/Assets.xcassets/**/*",
"BazelBuildSamples/ios-sample/ios-sample/Base.lproj/**/*"
"Sample/Sample/Base.lproj/**",
"Sample/Sample/Images.xcassets/**",
]),
deps = [
":test_grpc_objc",
]
)
ios_application(
name = "ios-sample",
bundle_id = "com.google.ios-sample-objc-bazel",
families = ["iphone"],
minimum_os_version = "9.0",
infoplists = ["BazelBuildSamples/ios-sample/ios-sample/Info.plist"],
name = "Sample",
bundle_id = "io.grpc.Sample",
minimum_os_version = "8.0",
infoplists = ["Sample/Sample/Info.plist"],
families = [
"iphone",
"ipad",
],
deps = ["Sample-lib"],
visibility = ["//visibility:public"],
deps = [":ios-sample-lib"],
)
)
grpc_objc_examples_library(
name = "InterceptorSample-lib",
srcs = glob(["InterceptorSample/InterceptorSample/**/*.m"]),
hdrs = glob(["InterceptorSample/InterceptorSample/**/*.h"]),
data = glob([
"InterceptorSample/InterceptorSample/Base.lproj/**",
"InterceptorSample/InterceptorSample/Images.xcassets/**",
]),
)
ios_application(
name = "InterceptorSample",
bundle_id = "io.grpc.InterceptorSample",
minimum_os_version = "9.0", # Safe Area Layout Guide used
infoplists = ["InterceptorSample/InterceptorSample/Info.plist"],
families = [
"iphone",
"ipad",
],
deps = ["InterceptorSample-lib"],
)
grpc_objc_examples_library(
name = "tvOS-sample-lib",
srcs = glob(["tvOS-sample/tvOS-sample/**/*.m"]),
hdrs = glob(["tvOS-sample/tvOS-sample/**/*.h"]),
data = glob([
"tvOS-sample/tvOS-sample/Base.lproj/**",
"tvOS-sample/tvOS-sample/Images.xcassets/**",
]),
)
# c-ares does not support tvOS CPU architecture with Bazel yet
tvos_application(
name = "tvOS-sample",
bundle_id = "io.grpc.tvOS-sample",
minimum_os_version = "10.0",
infoplists = ["tvOS-sample/tvOS-sample/Info.plist"],
deps = [":tvOS-sample-lib"],
)
grpc_objc_examples_library(
name = "watchOS-sample-iOS-lib",
srcs = glob(["watchOS-sample/watchOS-sample/**/*.m"]),
hdrs = glob(["watchOS-sample/watchOS-sample/**/*.h"]),
data = glob([
"watchOS-sample/watchOS-sample/Base.lproj/**",
"watchOS-sample/watchOS-sample/Images.xcassets/**",
]),
)
grpc_objc_examples_library(
name = "watchOS-sample-extension-lib",
srcs = glob(["watchOS-sample/WatchKit-Extention/**/*.m"]),
hdrs = glob(["watchOS-sample/WatchKit-Extension/**/*.h"]),
sdk_frameworks = [
"WatchConnectivity",
"WatchKit",
],
)
ios_application(
name = "watchOS-sample",
bundle_id = "io.grpc.watchOS-sample",
minimum_os_version = "9.0", # Safe Area Layout Guide used
families = ["iphone"],
infoplists = ["watchOS-sample/watchOS-sample/Info.plist"],
deps = [":watchOS-sample-iOS-lib"],
watch_application = "watchOS-sample-watchApp",
)
# c-ares does not support watchOS CPU architecture with Bazel yet
watchos_application(
name = "watchOS-sample-watchApp",
bundle_id = "io.grpc.watchOS-sample.watchkitapp",
minimum_os_version = "4.0",
storyboards = ["watchOS-sample/WatchKit-App/Base.lproj/Interface.storyboard"],
infoplists = ["watchOS-sample/WatchKit-App/Info.plist"],
extension = ":watchOS-sample-extension",
)
watchos_extension(
name = "watchOS-sample-extension",
bundle_id = "io.grpc.watchOS-sample.watchkitapp.watchkitextension",
minimum_os_version = "4.0",
infoplists = ["watchOS-sample/WatchKit-Extension/Info.plist"],
deps = [":watchOS-sample-extension-lib"],
)

@ -1,31 +0,0 @@
platform :ios, '8.0'
install! 'cocoapods', :deterministic_uuids => false
ROOT_DIR = '../../../../..'
target 'ios-sample' do
pod 'gRPC-ProtoRPC', :path => ROOT_DIR
pod 'gRPC', :path => ROOT_DIR
pod 'gRPC-Core', :path => ROOT_DIR
pod 'gRPC-RxLibrary', :path => ROOT_DIR
pod 'RemoteTest', :path => "../../RemoteTestClient"
pod '!ProtoCompiler-gRPCPlugin', :path => "#{ROOT_DIR}/src/objective-c"
end
pre_install do |installer|
grpc_core_spec = installer.pod_targets.find{|t| t.name.start_with?('gRPC-Core')}.root_spec
src_root = "$(PODS_TARGET_SRCROOT)"
grpc_core_spec.pod_target_xcconfig = {
'GRPC_SRC_ROOT' => src_root,
'HEADER_SEARCH_PATHS' => '"$(inherited)" "$(GRPC_SRC_ROOT)/include"',
'USER_HEADER_SEARCH_PATHS' => '"$(GRPC_SRC_ROOT)"',
# If we don't set these two settings, `include/grpc/support/time.h` and
# `src/core/lib/gpr/string.h` shadow the system `<time.h>` and `<string.h>`, breaking the
# build.
'USE_HEADERMAP' => 'NO',
'ALWAYS_SEARCH_USER_PATHS' => 'NO',
}
end

@ -1,413 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objects = {
/* Begin PBXBuildFile section */
AB433CC922D7E38000D579CC /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CC822D7E38000D579CC /* AppDelegate.m */; };
AB433CCC22D7E38000D579CC /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CCB22D7E38000D579CC /* ViewController.m */; };
AB433CCF22D7E38000D579CC /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB433CCD22D7E38000D579CC /* Main.storyboard */; };
AB433CD122D7E38100D579CC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB433CD022D7E38100D579CC /* Assets.xcassets */; };
AB433CD422D7E38100D579CC /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */; };
AB433CD722D7E38100D579CC /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = AB433CD622D7E38100D579CC /* main.m */; };
ED11F6CDF54788FC7CFD87B1 /* libPods-ios-sample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-sample.release.xcconfig"; path = "Target Support Files/Pods-ios-sample/Pods-ios-sample.release.xcconfig"; sourceTree = "<group>"; };
5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ios-sample.a"; sourceTree = BUILT_PRODUCTS_DIR; };
72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ios-sample.debug.xcconfig"; path = "Target Support Files/Pods-ios-sample/Pods-ios-sample.debug.xcconfig"; sourceTree = "<group>"; };
AB433CC422D7E38000D579CC /* ios-sample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ios-sample.app"; sourceTree = BUILT_PRODUCTS_DIR; };
AB433CC722D7E38000D579CC /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
AB433CC822D7E38000D579CC /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
AB433CCA22D7E38000D579CC /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
AB433CCB22D7E38000D579CC /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
AB433CCE22D7E38000D579CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
AB433CD022D7E38100D579CC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
AB433CD322D7E38100D579CC /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
AB433CD522D7E38100D579CC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AB433CD622D7E38100D579CC /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
AB433CC122D7E38000D579CC /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
ED11F6CDF54788FC7CFD87B1 /* libPods-ios-sample.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
2A170580B60E92B1A65525D4 /* Pods */ = {
isa = PBXGroup;
children = (
72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */,
112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
AB433CBB22D7E38000D579CC = {
isa = PBXGroup;
children = (
AB433CC622D7E38000D579CC /* ios-sample */,
AB433CC522D7E38000D579CC /* Products */,
2A170580B60E92B1A65525D4 /* Pods */,
FD148AE940967C50DB2C12CB /* Frameworks */,
);
sourceTree = "<group>";
};
AB433CC522D7E38000D579CC /* Products */ = {
isa = PBXGroup;
children = (
AB433CC422D7E38000D579CC /* ios-sample.app */,
);
name = Products;
sourceTree = "<group>";
};
AB433CC622D7E38000D579CC /* ios-sample */ = {
isa = PBXGroup;
children = (
AB433CC722D7E38000D579CC /* AppDelegate.h */,
AB433CC822D7E38000D579CC /* AppDelegate.m */,
AB433CCA22D7E38000D579CC /* ViewController.h */,
AB433CCB22D7E38000D579CC /* ViewController.m */,
AB433CCD22D7E38000D579CC /* Main.storyboard */,
AB433CD022D7E38100D579CC /* Assets.xcassets */,
AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */,
AB433CD522D7E38100D579CC /* Info.plist */,
AB433CD622D7E38100D579CC /* main.m */,
);
path = "ios-sample";
sourceTree = "<group>";
};
FD148AE940967C50DB2C12CB /* Frameworks */ = {
isa = PBXGroup;
children = (
5AF80A181E30BD84FA56BE33 /* libPods-ios-sample.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
AB433CC322D7E38000D579CC /* ios-sample */ = {
isa = PBXNativeTarget;
buildConfigurationList = AB433CDA22D7E38100D579CC /* Build configuration list for PBXNativeTarget "ios-sample" */;
buildPhases = (
9DD34A50D448CD3F464D4A3C /* [CP] Check Pods Manifest.lock */,
AB433CC022D7E38000D579CC /* Sources */,
AB433CC122D7E38000D579CC /* Frameworks */,
AB433CC222D7E38000D579CC /* Resources */,
630985F7228D41528084692C /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = "ios-sample";
productName = "ios-sample";
productReference = AB433CC422D7E38000D579CC /* ios-sample.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
AB433CBC22D7E38000D579CC /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1010;
ORGANIZATIONNAME = "Tony Lu";
TargetAttributes = {
AB433CC322D7E38000D579CC = {
CreatedOnToolsVersion = 10.1;
};
};
};
buildConfigurationList = AB433CBF22D7E38000D579CC /* Build configuration list for PBXProject "ios-sample" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = AB433CBB22D7E38000D579CC;
productRefGroup = AB433CC522D7E38000D579CC /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
AB433CC322D7E38000D579CC /* ios-sample */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
AB433CC222D7E38000D579CC /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AB433CD422D7E38100D579CC /* LaunchScreen.storyboard in Resources */,
AB433CD122D7E38100D579CC /* Assets.xcassets in Resources */,
AB433CCF22D7E38000D579CC /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
630985F7228D41528084692C /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ios-sample/Pods-ios-sample-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9DD34A50D448CD3F464D4A3C /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ios-sample-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
AB433CC022D7E38000D579CC /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
AB433CCC22D7E38000D579CC /* ViewController.m in Sources */,
AB433CD722D7E38100D579CC /* main.m in Sources */,
AB433CC922D7E38000D579CC /* AppDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
AB433CCD22D7E38000D579CC /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
AB433CCE22D7E38000D579CC /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
AB433CD222D7E38100D579CC /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
AB433CD322D7E38100D579CC /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
AB433CD822D7E38100D579CC /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
};
name = Debug;
};
AB433CD922D7E38100D579CC /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.1;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
AB433CDB22D7E38100D579CC /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 72599BE4AC5785D3368D40DD /* Pods-ios-sample.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 6T98ZJNPG5;
INFOPLIST_FILE = "ios-sample/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.google.ios-sample-objc-bazel";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
AB433CDC22D7E38100D579CC /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 112D4595FA3E81552DA9E877 /* Pods-ios-sample.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = 6T98ZJNPG5;
INFOPLIST_FILE = "ios-sample/Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.google.ios-sample-objc-bazel";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
AB433CBF22D7E38000D579CC /* Build configuration list for PBXProject "ios-sample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AB433CD822D7E38100D579CC /* Debug */,
AB433CD922D7E38100D579CC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
AB433CDA22D7E38100D579CC /* Build configuration list for PBXNativeTarget "ios-sample" */ = {
isa = XCConfigurationList;
buildConfigurations = (
AB433CDB22D7E38100D579CC /* Debug */,
AB433CDC22D7E38100D579CC /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = AB433CBC22D7E38000D579CC /* Project object */;
}

@ -1,63 +0,0 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import "AppDelegate.h"
@interface AppDelegate ()
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application {
// Sent when the application is about to move from active to inactive state. This can occur for
// certain types of temporary interruptions (such as an incoming phone call or SMS message) or
// when the user quits the application and it begins the transition to the background state. Use
// this method to pause ongoing tasks, disable timers, and invalidate graphics rendering
// callbacks. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application {
// Use this method to release shared resources, save user data, invalidate timers, and store
// enough application state information to restore your application to its current state in case
// it is terminated later. If your application supports background execution, this method is
// called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo
// many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If
// the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application {
// Called when the application is about to terminate. Save data if appropriate. See also
// applicationDidEnterBackground:.
}
@end

@ -1,98 +0,0 @@
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "60x60",
"scale" : "3x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "1x"
},
{
"idiom" : "ipad",
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "ipad",
"size" : "83.5x83.5",
"scale" : "2x"
},
{
"idiom" : "ios-marketing",
"size" : "1024x1024",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="ViewController" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iTL-zv-YSZ">
<rect key="frame" x="164" y="318" width="46" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Button"/>
<connections>
<action selector="tapCall:" destination="BYZ-38-t0r" eventType="touchUpInside" id="c5c-m5-SGC"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>

@ -1,86 +0,0 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#import "ViewController.h"
#import <GRPCClient/GRPCCall.h>
#if COCOAPODS
#import <RemoteTest/Messages.pbobjc.h>
#import <RemoteTest/Test.pbrpc.h>
#else
#import "src/objective-c/examples/BazelBuildSamples/Messages.pbobjc.h"
#import "src/objective-c/examples/BazelBuildSamples/rmt/Test.pbrpc.h"
#endif
static NSString *const kPackage = @"grpc.testing";
static NSString *const kService = @"TestService";
@interface ViewController ()<GRPCResponseHandler>
@end
@implementation ViewController {
GRPCCallOptions *_options;
}
- (void)viewDidLoad {
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
// optionally modify options
_options = options;
}
- (IBAction)tapCall:(id)sender {
GRPCProtoMethod *kUnaryCallMethod =
[[GRPCProtoMethod alloc] initWithPackage:kPackage service:kService method:@"UnaryCall"];
GRPCRequestOptions *requestOptions =
[[GRPCRequestOptions alloc] initWithHost:@"grpc-test.sandbox.googleapis.com"
path:kUnaryCallMethod.HTTPPath
safety:GRPCCallSafetyCacheableRequest];
GRPCCall2 *call = [[GRPCCall2 alloc] initWithRequestOptions:requestOptions
responseHandler:self
callOptions:_options];
RMTSimpleRequest *request = [RMTSimpleRequest message];
request.responseSize = 100;
[call start];
[call writeData:[request data]];
[call finish];
}
- (dispatch_queue_t)dispatchQueue {
return dispatch_get_main_queue();
}
- (void)didReceiveInitialMetadata:(NSDictionary *)initialMetadata {
NSLog(@"Header: %@", initialMetadata);
}
- (void)didReceiveData:(id)data {
NSLog(@"Message: %@", data);
}
- (void)didCloseWithTrailingMetadata:(NSDictionary *)trailingMetadata error:(NSError *)error {
NSLog(@"Trailer: %@\nError: %@", trailingMetadata, error);
}
@end

@ -1,118 +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.
// Message definitions to be used by integration test service definitions.
syntax = "proto3";
package grpc.testing;
option objc_class_prefix = "RMT";
// The type of payload that should be returned.
enum PayloadType {
// Compressable text format.
COMPRESSABLE = 0;
// Uncompressable binary format.
UNCOMPRESSABLE = 1;
// Randomly chosen from all other formats defined in this enum.
RANDOM = 2;
}
// A block of data, to simply increase gRPC message size.
message Payload {
// The type of data in body.
PayloadType type = 1;
// Primary contents of payload.
bytes body = 2;
}
// Unary request.
message SimpleRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, server randomly chooses one from other formats.
PayloadType response_type = 1;
// Desired payload size in the response from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
int32 response_size = 2;
// Optional input payload sent along with the request.
Payload payload = 3;
// Whether SimpleResponse should include username.
bool fill_username = 4;
// Whether SimpleResponse should include OAuth scope.
bool fill_oauth_scope = 5;
}
// Unary response, as configured by the request.
message SimpleResponse {
// Payload to increase message size.
Payload payload = 1;
// The user the request came from, for verifying authentication was
// successful when the client expected it.
string username = 2;
// OAuth scope.
string oauth_scope = 3;
}
// Client-streaming request.
message StreamingInputCallRequest {
// Optional input payload sent along with the request.
Payload payload = 1;
// Not expecting any payload from the response.
}
// Client-streaming response.
message StreamingInputCallResponse {
// Aggregated size of payloads received from the client.
int32 aggregated_payload_size = 1;
}
// Configuration for a particular response.
message ResponseParameters {
// Desired payload sizes in responses from the server.
// If response_type is COMPRESSABLE, this denotes the size before compression.
int32 size = 1;
// Desired interval between consecutive responses in the response stream in
// microseconds.
int32 interval_us = 2;
}
// Server-streaming request.
message StreamingOutputCallRequest {
// Desired payload type in the response from the server.
// If response_type is RANDOM, the payload from each response in the stream
// might be of different types. This is to simulate a mixed type of payload
// stream.
PayloadType response_type = 1;
// Configuration for each expected response message.
repeated ResponseParameters response_parameters = 2;
// Optional input payload sent along with the request.
Payload payload = 3;
}
// Server-streaming response, as configured by the request and parameters.
message StreamingOutputCallResponse {
// Payload to increase response size.
Payload payload = 1;
}

@ -1,57 +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.
// An integration test service that covers all the method signature permutations
// of unary/streaming requests/responses.
syntax = "proto3";
import "google/protobuf/empty.proto";
import "src/objective-c/examples/BazelBuildSamples/messages.proto";
package grpc.testing;
option objc_class_prefix = "RMT";
// A simple service to test the various types of RPCs and experiment with
// performance with various types of payload.
service TestService {
// One empty request followed by one empty response.
rpc EmptyCall(google.protobuf.Empty) returns (google.protobuf.Empty);
// One request followed by one response.
rpc UnaryCall(SimpleRequest) returns (SimpleResponse);
// One request followed by a sequence of responses (streamed download).
// The server returns the payload with client desired type and sizes.
rpc StreamingOutputCall(StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// A sequence of requests followed by one response (streamed upload).
// The server returns the aggregated size of client payload as the result.
rpc StreamingInputCall(stream StreamingInputCallRequest)
returns (StreamingInputCallResponse);
// A sequence of requests with each request served by the server immediately.
// As one request could lead to multiple responses, this interface
// demonstrates the idea of full duplexing.
rpc FullDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
// A sequence of requests followed by a sequence of responses.
// The server buffers all the client requests and then serves them in order. A
// stream of responses are returned to the client when the server starts with
// first request.
rpc HalfDuplexCall(stream StreamingOutputCallRequest)
returns (stream StreamingOutputCallResponse);
}

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<string>en_US</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>

@ -16,11 +16,11 @@ Pod::Spec.new do |s|
s.dependency "!ProtoCompiler-gRPCPlugin"
repo_root = '../../../..'
bin_dir = "#{repo_root}/bins/$CONFIG"
bazel_exec_root = "#{repo_root}/bazel-out/darwin-fastbuild/bin"
protoc = "#{bin_dir}/protobuf/protoc"
protoc = "#{bazel_exec_root}/external/com_google_protobuf/protoc"
well_known_types_dir = "#{repo_root}/third_party/protobuf/src"
plugin = "#{bin_dir}/grpc_objective_c_plugin"
plugin = "#{bazel_exec_root}/src/compiler/grpc_objective_c_plugin"
# Since we switched to importing full path, -I needs to be set to the directory
# from which the imported file can be found, which is the grpc's root here

@ -327,7 +327,7 @@
INFOPLIST_FILE = Sample/Info.plist;
LD_GENERATE_MAP_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = io.grpc.Sample;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
@ -340,7 +340,7 @@
INFOPLIST_FILE = Sample/Info.plist;
LD_GENERATE_MAP_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "org.grpc.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_BUNDLE_IDENTIFIER = io.grpc.Sample;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>en_US</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>

@ -194,7 +194,6 @@
"${BUILT_PRODUCTS_DIR}/gRPC-Core/grpc.framework",
"${BUILT_PRODUCTS_DIR}/gRPC-ProtoRPC/ProtoRPC.framework",
"${BUILT_PRODUCTS_DIR}/gRPC-RxLibrary/RxLibrary.framework",
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@ -205,7 +204,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ProtoRPC.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxLibrary.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;

@ -171,7 +171,6 @@
"${BUILT_PRODUCTS_DIR}/gRPC-Core/grpc.framework",
"${BUILT_PRODUCTS_DIR}/gRPC-ProtoRPC/ProtoRPC.framework",
"${BUILT_PRODUCTS_DIR}/gRPC-RxLibrary/RxLibrary.framework",
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
@ -182,7 +181,6 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/ProtoRPC.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/RxLibrary.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@ -214,7 +212,7 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-tvOS-sample/Pods-tvOS-sample-resources.sh",
"$PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle",
$PODS_CONFIGURATION_BUILD_DIR/gRPC/gRPCCertificates.bundle,
);
name = "[CP] Copy Pods Resources";
outputPaths = (
@ -365,7 +363,7 @@
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "tvOS-sample/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-sample";
PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.tvOS-sample";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = 3;
@ -384,7 +382,7 @@
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = "tvOS-sample/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.google.tvOS-sample";
PRODUCT_BUNDLE_IDENTIFIER = "io.grpc.tvOS-sample";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
TARGETED_DEVICE_FAMILY = 3;

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<string>en_US</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>

@ -33,6 +33,20 @@
"role" : "appLauncher",
"subtype" : "38mm"
},
{
"size" : "44x44",
"idiom" : "watch",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "40mm"
},
{
"size" : "50x50",
"idiom" : "watch",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "44mm"
},
{
"size" : "86x86",
"idiom" : "watch",
@ -47,6 +61,13 @@
"role" : "quickLook",
"subtype" : "42mm"
},
{
"size" : "108x108",
"idiom" : "watch",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "44mm"
},
{
"idiom" : "watch-marketing",
"size" : "1024x1024",

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

Loading…
Cancel
Save