aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-04-06 10:29:18 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-04-06 10:29:18 -0700
commit36bb50aaedc2e09d63149f96cb9ebb5ae0e2500e (patch)
treece54f6c973152c6aee9129b4c3a0cf3a476a0ca4
parentf64df1124a8c3ea7dce0bed3aca4ff15da04e26d (diff)
parent39a96967f1b003391b02317bf7c6fb003edc4722 (diff)
Merge github.com:grpc/grpc into e2efuzz
-rw-r--r--BUILD192
-rw-r--r--Makefile68
-rw-r--r--README.md2
-rw-r--r--binding.gyp34
-rw-r--r--build.yaml72
-rw-r--r--config.m436
-rw-r--r--gRPC.podspec94
-rwxr-xr-xgrpc.gemspec64
-rw-r--r--include/grpc++/impl/codegen/async_stream.h36
-rw-r--r--include/grpc++/impl/codegen/async_unary_call.h12
-rw-r--r--include/grpc++/impl/codegen/call.h7
-rw-r--r--include/grpc++/impl/codegen/client_context.h13
-rw-r--r--include/grpc++/impl/codegen/client_unary_call.h3
-rw-r--r--include/grpc++/impl/codegen/method_handler_impl.h15
-rw-r--r--include/grpc++/impl/codegen/server_context.h2
-rw-r--r--include/grpc++/impl/codegen/sync_stream.h24
-rw-r--r--include/grpc/impl/codegen/grpc_types.h8
-rw-r--r--package.json64
-rw-r--r--package.xml64
-rw-r--r--src/compiler/csharp_generator.cc157
-rw-r--r--src/core/ext/client_config/README.md (renamed from src/core/lib/client_config/README.md)2
-rw-r--r--src/core/ext/client_config/channel_connectivity.c (renamed from src/core/lib/surface/channel_connectivity.c)2
-rw-r--r--src/core/ext/client_config/client_channel.c (renamed from src/core/lib/channel/client_channel.c)44
-rw-r--r--src/core/ext/client_config/client_channel.h (renamed from src/core/lib/channel/client_channel.h)8
-rw-r--r--src/core/ext/client_config/client_channel_factory.c57
-rw-r--r--src/core/ext/client_config/client_channel_factory.h85
-rw-r--r--src/core/ext/client_config/client_config.c (renamed from src/core/lib/client_config/client_config.c)2
-rw-r--r--src/core/ext/client_config/client_config.h (renamed from src/core/lib/client_config/client_config.h)8
-rw-r--r--src/core/ext/client_config/connector.c (renamed from src/core/lib/client_config/connector.c)2
-rw-r--r--src/core/ext/client_config/connector.h (renamed from src/core/lib/client_config/connector.h)6
-rw-r--r--src/core/ext/client_config/default_initial_connect_string.c (renamed from src/core/lib/client_config/default_initial_connect_string.c)0
-rw-r--r--src/core/ext/client_config/initial_connect_string.c (renamed from src/core/lib/client_config/initial_connect_string.c)2
-rw-r--r--src/core/ext/client_config/initial_connect_string.h (renamed from src/core/lib/client_config/initial_connect_string.h)6
-rw-r--r--src/core/ext/client_config/lb_policy.c (renamed from src/core/lib/client_config/lb_policy.c)13
-rw-r--r--src/core/ext/client_config/lb_policy.h (renamed from src/core/lib/client_config/lb_policy.h)21
-rw-r--r--src/core/ext/client_config/lb_policy_factory.c (renamed from src/core/lib/client_config/lb_policy_factory.c)2
-rw-r--r--src/core/ext/client_config/lb_policy_factory.h (renamed from src/core/lib/client_config/lb_policy_factory.h)12
-rw-r--r--src/core/ext/client_config/lb_policy_registry.c (renamed from src/core/lib/client_config/lb_policy_registry.c)2
-rw-r--r--src/core/ext/client_config/lb_policy_registry.h (renamed from src/core/lib/client_config/lb_policy_registry.h)8
-rw-r--r--src/core/ext/client_config/resolver.c (renamed from src/core/lib/client_config/resolver.c)2
-rw-r--r--src/core/ext/client_config/resolver.h (renamed from src/core/lib/client_config/resolver.h)10
-rw-r--r--src/core/ext/client_config/resolver_factory.c (renamed from src/core/lib/client_config/resolver_factory.c)2
-rw-r--r--src/core/ext/client_config/resolver_factory.h (renamed from src/core/lib/client_config/resolver_factory.h)14
-rw-r--r--src/core/ext/client_config/resolver_registry.c (renamed from src/core/lib/client_config/resolver_registry.c)6
-rw-r--r--src/core/ext/client_config/resolver_registry.h (renamed from src/core/lib/client_config/resolver_registry.h)10
-rw-r--r--src/core/ext/client_config/subchannel.c (renamed from src/core/lib/client_config/subchannel.c)29
-rw-r--r--src/core/ext/client_config/subchannel.h (renamed from src/core/lib/client_config/subchannel.h)8
-rw-r--r--src/core/ext/client_config/subchannel_call_holder.c (renamed from src/core/lib/channel/subchannel_call_holder.c)7
-rw-r--r--src/core/ext/client_config/subchannel_call_holder.h (renamed from src/core/lib/channel/subchannel_call_holder.h)9
-rw-r--r--src/core/ext/client_config/subchannel_factory.c (renamed from src/core/lib/client_config/subchannel_factory.c)2
-rw-r--r--src/core/ext/client_config/subchannel_factory.h (renamed from src/core/lib/client_config/subchannel_factory.h)8
-rw-r--r--src/core/ext/client_config/subchannel_index.c (renamed from src/core/lib/client_config/subchannel_index.c)2
-rw-r--r--src/core/ext/client_config/subchannel_index.h (renamed from src/core/lib/client_config/subchannel_index.h)10
-rw-r--r--src/core/ext/client_config/uri_parser.c (renamed from src/core/lib/client_config/uri_parser.c)2
-rw-r--r--src/core/ext/client_config/uri_parser.h (renamed from src/core/lib/client_config/uri_parser.h)6
-rw-r--r--src/core/ext/lb_policy/grpclb/load_balancer_api.h2
-rw-r--r--src/core/ext/lb_policy/pick_first/pick_first.c56
-rw-r--r--src/core/ext/lb_policy/round_robin/round_robin.c48
-rw-r--r--src/core/ext/resolver/dns/native/dns_resolver.c14
-rw-r--r--src/core/ext/resolver/sockaddr/sockaddr_resolver.c52
-rw-r--r--src/core/ext/resolver/zookeeper/zookeeper_resolver.c15
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create.c93
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.c105
-rw-r--r--src/core/lib/channel/http_client_filter.c10
-rw-r--r--src/core/lib/iomgr/ev_poll_and_epoll_posix.c2
-rw-r--r--src/core/lib/iomgr/ev_posix.c2
-rw-r--r--src/core/lib/iomgr/ev_posix.h2
-rw-r--r--src/core/lib/iomgr/unix_sockets_posix.h4
-rw-r--r--src/core/lib/surface/call.c10
-rw-r--r--src/core/lib/surface/channel.c2
-rw-r--r--src/core/lib/surface/channel.h1
-rw-r--r--src/core/lib/surface/init.c10
-rw-r--r--src/core/lib/transport/transport.h6
-rw-r--r--src/cpp/client/client_context.cc2
-rw-r--r--src/csharp/Grpc.Core/CallInvoker.cs84
-rw-r--r--src/csharp/Grpc.Core/ClientBase.cs161
-rw-r--r--src/csharp/Grpc.Core/DefaultCallInvoker.cs112
-rw-r--r--src/csharp/Grpc.Core/Grpc.Core.csproj4
-rw-r--r--src/csharp/Grpc.Core/Internal/InterceptingCallInvoker.cs134
-rw-r--r--src/csharp/Grpc.Core/Internal/UnimplementedCallInvoker.cs75
-rw-r--r--src/csharp/Grpc.Examples.MathClient/MathClient.cs4
-rw-r--r--src/csharp/Grpc.Examples/MathExamples.cs14
-rw-r--r--src/csharp/Grpc.Examples/MathGrpc.cs105
-rw-r--r--src/csharp/Grpc.Examples/MathServiceImpl.cs12
-rw-r--r--src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs2
-rw-r--r--src/csharp/Grpc.HealthCheck/HealthGrpc.cs57
-rw-r--r--src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs4
-rw-r--r--src/csharp/Grpc.IntegrationTesting/BenchmarkServiceImpl.cs8
-rw-r--r--src/csharp/Grpc.IntegrationTesting/ClientRunners.cs123
-rw-r--r--src/csharp/Grpc.IntegrationTesting/GeneratedClientTest.cs106
-rw-r--r--src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs116
-rw-r--r--src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj4
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InterarrivalTimers.cs148
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClient.cs26
-rw-r--r--src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs2
-rw-r--r--src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs8
-rw-r--r--src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs188
-rw-r--r--src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs4
-rw-r--r--src/csharp/Grpc.IntegrationTesting/TestGrpc.cs287
-rw-r--r--src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs16
-rw-r--r--src/csharp/Grpc.IntegrationTesting/WorkerServiceImpl.cs10
-rw-r--r--src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec2
-rw-r--r--src/csharp/tests.json3
-rw-r--r--src/proto/grpc/testing/messages.proto8
-rw-r--r--src/proto/grpc/testing/metrics.proto4
-rw-r--r--src/proto/grpc/testing/test.proto4
-rw-r--r--src/python/grpcio/grpc/beta/implementations.py2
-rw-r--r--src/python/grpcio/grpc_core_dependencies.py34
-rw-r--r--src/python/grpcio/tests/interop/_secure_interop_test.py2
-rw-r--r--src/python/grpcio/tests/interop/client.py2
-rw-r--r--src/python/grpcio/tests/unit/beta/_beta_features_test.py2
-rw-r--r--src/python/grpcio/tests/unit/beta/_face_interface_test.py2
-rw-r--r--src/ruby/ext/grpc/rb_call.c6
-rw-r--r--src/ruby/lib/grpc/generic/rpc_server.rb4
-rw-r--r--src/ruby/spec/generic/client_stub_spec.rb35
-rw-r--r--src/ruby/spec/generic/rpc_server_spec.rb5
-rw-r--r--test/core/bad_ssl/bad_ssl_test.c2
-rw-r--r--test/core/client_config/lb_policies_test.c4
-rw-r--r--test/core/client_config/resolvers/dns_resolver_connectivity_test.c30
-rw-r--r--test/core/client_config/resolvers/dns_resolver_test.c30
-rw-r--r--test/core/client_config/resolvers/sockaddr_resolver_test.c30
-rw-r--r--test/core/client_config/set_initial_connect_string_test.c2
-rw-r--r--test/core/client_config/uri_fuzzer_test.c2
-rw-r--r--test/core/client_config/uri_parser_test.c2
-rw-r--r--test/core/end2end/dualstack_socket_test.c4
-rw-r--r--test/core/end2end/fixtures/h2_census.c2
-rw-r--r--test/core/end2end/fixtures/h2_compress.c2
-rw-r--r--test/core/end2end/fixtures/h2_full+pipe.c2
-rw-r--r--test/core/end2end/fixtures/h2_full+trace.c2
-rw-r--r--test/core/end2end/fixtures/h2_full.c2
-rw-r--r--test/core/end2end/fixtures/h2_proxy.c2
-rw-r--r--test/core/end2end/fixtures/h2_sockpair+trace.c2
-rw-r--r--test/core/end2end/fixtures/h2_sockpair.c2
-rw-r--r--test/core/end2end/fixtures/h2_sockpair_1byte.c2
-rw-r--r--test/core/end2end/fixtures/h2_uds.c2
-rw-r--r--test/core/end2end/fixtures/proxy.c2
-rw-r--r--test/core/end2end/tests/idempotent_request.c2
-rw-r--r--test/core/end2end/tests/simple_delayed_request.c2
-rw-r--r--test/core/internal_api_canaries/iomgr.c2
-rw-r--r--test/core/internal_api_canaries/support.c2
-rw-r--r--test/core/internal_api_canaries/transport.c2
-rw-r--r--test/core/surface/channel_create_test.c2
-rw-r--r--test/core/surface/secure_channel_create_test.c2
-rw-r--r--test/core/surface/server_test.c2
-rw-r--r--test/core/util/reconnect_server.c9
-rw-r--r--test/core/util/reconnect_server.h3
-rw-r--r--test/cpp/end2end/client_crash_test.cc2
-rw-r--r--test/cpp/end2end/server_crash_test_client.cc1
-rw-r--r--test/cpp/interop/reconnect_interop_client.cc26
-rw-r--r--test/cpp/interop/reconnect_interop_server.cc10
-rw-r--r--test/cpp/util/create_test_channel.cc15
-rw-r--r--test/cpp/util/create_test_channel.h8
-rw-r--r--tools/doxygen/Doxyfile.core.internal64
-rwxr-xr-xtools/gce/create_interop_worker.sh2
-rwxr-xr-xtools/gource/gource.sh1
-rw-r--r--tools/run_tests/performance/__init__.py28
-rwxr-xr-xtools/run_tests/performance/build_performance.sh17
-rwxr-xr-xtools/run_tests/performance/remote_host_build.sh2
-rwxr-xr-xtools/run_tests/performance/remote_host_prepare.sh2
-rwxr-xr-xtools/run_tests/performance/run_worker_csharp.sh2
-rwxr-xr-xtools/run_tests/performance/run_worker_node.sh2
-rw-r--r--tools/run_tests/performance/scenario_config.py153
-rwxr-xr-xtools/run_tests/run_node.sh3
-rwxr-xr-xtools/run_tests/run_performance_tests.py133
-rw-r--r--tools/run_tests/sources_and_headers.json188
-rw-r--r--vsprojects/vcxproj/grpc/grpc.vcxproj98
-rw-r--r--vsprojects/vcxproj/grpc/grpc.vcxproj.filters198
-rw-r--r--vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj98
-rw-r--r--vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters198
169 files changed, 3430 insertions, 1718 deletions
diff --git a/BUILD b/BUILD
index fbe69f3a6d..1335bdeb34 100644
--- a/BUILD
+++ b/BUILD
@@ -165,6 +165,21 @@ cc_library(
"src/core/ext/census/grpc_filter.h",
"src/core/ext/census/mlog.h",
"src/core/ext/census/rpc_metric_id.h",
+ "src/core/ext/client_config/client_channel.h",
+ "src/core/ext/client_config/client_channel_factory.h",
+ "src/core/ext/client_config/client_config.h",
+ "src/core/ext/client_config/connector.h",
+ "src/core/ext/client_config/initial_connect_string.h",
+ "src/core/ext/client_config/lb_policy.h",
+ "src/core/ext/client_config/lb_policy_factory.h",
+ "src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/resolver.h",
+ "src/core/ext/client_config/resolver_factory.h",
+ "src/core/ext/client_config/resolver_registry.h",
+ "src/core/ext/client_config/subchannel.h",
+ "src/core/ext/client_config/subchannel_call_holder.h",
+ "src/core/ext/client_config/subchannel_index.h",
+ "src/core/ext/client_config/uri_parser.h",
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/ext/transport/chttp2/transport/alpn.h",
@@ -191,26 +206,11 @@ cc_library(
"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/client_channel.h",
"src/core/lib/channel/compress_filter.h",
"src/core/lib/channel/connected_channel.h",
"src/core/lib/channel/context.h",
"src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.h",
- "src/core/lib/channel/subchannel_call_holder.h",
- "src/core/lib/client_config/client_config.h",
- "src/core/lib/client_config/connector.h",
- "src/core/lib/client_config/initial_connect_string.h",
- "src/core/lib/client_config/lb_policy.h",
- "src/core/lib/client_config/lb_policy_factory.h",
- "src/core/lib/client_config/lb_policy_registry.h",
- "src/core/lib/client_config/resolver.h",
- "src/core/lib/client_config/resolver_factory.h",
- "src/core/lib/client_config/resolver_registry.h",
- "src/core/lib/client_config/subchannel.h",
- "src/core/lib/client_config/subchannel_factory.h",
- "src/core/lib/client_config/subchannel_index.h",
- "src/core/lib/client_config/uri_parser.h",
"src/core/lib/compression/algorithm_metadata.h",
"src/core/lib/compression/message_compress.h",
"src/core/lib/debug/trace.h",
@@ -299,6 +299,23 @@ cc_library(
"src/core/ext/census/operation.c",
"src/core/ext/census/placeholders.c",
"src/core/ext/census/tracing.c",
+ "src/core/ext/client_config/channel_connectivity.c",
+ "src/core/ext/client_config/client_channel.c",
+ "src/core/ext/client_config/client_channel_factory.c",
+ "src/core/ext/client_config/client_config.c",
+ "src/core/ext/client_config/connector.c",
+ "src/core/ext/client_config/default_initial_connect_string.c",
+ "src/core/ext/client_config/initial_connect_string.c",
+ "src/core/ext/client_config/lb_policy.c",
+ "src/core/ext/client_config/lb_policy_factory.c",
+ "src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/resolver.c",
+ "src/core/ext/client_config/resolver_factory.c",
+ "src/core/ext/client_config/resolver_registry.c",
+ "src/core/ext/client_config/subchannel.c",
+ "src/core/ext/client_config/subchannel_call_holder.c",
+ "src/core/ext/client_config/subchannel_index.c",
+ "src/core/ext/client_config/uri_parser.c",
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c",
"src/core/ext/lb_policy/pick_first/pick_first.c",
@@ -333,26 +350,10 @@ cc_library(
"src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_stack.c",
"src/core/lib/channel/channel_stack_builder.c",
- "src/core/lib/channel/client_channel.c",
"src/core/lib/channel/compress_filter.c",
"src/core/lib/channel/connected_channel.c",
"src/core/lib/channel/http_client_filter.c",
"src/core/lib/channel/http_server_filter.c",
- "src/core/lib/channel/subchannel_call_holder.c",
- "src/core/lib/client_config/client_config.c",
- "src/core/lib/client_config/connector.c",
- "src/core/lib/client_config/default_initial_connect_string.c",
- "src/core/lib/client_config/initial_connect_string.c",
- "src/core/lib/client_config/lb_policy.c",
- "src/core/lib/client_config/lb_policy_factory.c",
- "src/core/lib/client_config/lb_policy_registry.c",
- "src/core/lib/client_config/resolver.c",
- "src/core/lib/client_config/resolver_factory.c",
- "src/core/lib/client_config/resolver_registry.c",
- "src/core/lib/client_config/subchannel.c",
- "src/core/lib/client_config/subchannel_factory.c",
- "src/core/lib/client_config/subchannel_index.c",
- "src/core/lib/client_config/uri_parser.c",
"src/core/lib/compression/compression_algorithm.c",
"src/core/lib/compression/message_compress.c",
"src/core/lib/debug/trace.c",
@@ -425,7 +426,6 @@ cc_library(
"src/core/lib/surface/call_details.c",
"src/core/lib/surface/call_log_batch.c",
"src/core/lib/surface/channel.c",
- "src/core/lib/surface/channel_connectivity.c",
"src/core/lib/surface/channel_init.c",
"src/core/lib/surface/channel_ping.c",
"src/core/lib/surface/channel_stack_type.c",
@@ -528,6 +528,21 @@ cc_library(
"src/core/ext/census/grpc_filter.h",
"src/core/ext/census/mlog.h",
"src/core/ext/census/rpc_metric_id.h",
+ "src/core/ext/client_config/client_channel.h",
+ "src/core/ext/client_config/client_channel_factory.h",
+ "src/core/ext/client_config/client_config.h",
+ "src/core/ext/client_config/connector.h",
+ "src/core/ext/client_config/initial_connect_string.h",
+ "src/core/ext/client_config/lb_policy.h",
+ "src/core/ext/client_config/lb_policy_factory.h",
+ "src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/resolver.h",
+ "src/core/ext/client_config/resolver_factory.h",
+ "src/core/ext/client_config/resolver_registry.h",
+ "src/core/ext/client_config/subchannel.h",
+ "src/core/ext/client_config/subchannel_call_holder.h",
+ "src/core/ext/client_config/subchannel_index.h",
+ "src/core/ext/client_config/uri_parser.h",
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/ext/transport/chttp2/transport/alpn.h",
@@ -554,26 +569,11 @@ cc_library(
"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/client_channel.h",
"src/core/lib/channel/compress_filter.h",
"src/core/lib/channel/connected_channel.h",
"src/core/lib/channel/context.h",
"src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.h",
- "src/core/lib/channel/subchannel_call_holder.h",
- "src/core/lib/client_config/client_config.h",
- "src/core/lib/client_config/connector.h",
- "src/core/lib/client_config/initial_connect_string.h",
- "src/core/lib/client_config/lb_policy.h",
- "src/core/lib/client_config/lb_policy_factory.h",
- "src/core/lib/client_config/lb_policy_registry.h",
- "src/core/lib/client_config/resolver.h",
- "src/core/lib/client_config/resolver_factory.h",
- "src/core/lib/client_config/resolver_registry.h",
- "src/core/lib/client_config/subchannel.h",
- "src/core/lib/client_config/subchannel_factory.h",
- "src/core/lib/client_config/subchannel_index.h",
- "src/core/lib/client_config/uri_parser.h",
"src/core/lib/compression/algorithm_metadata.h",
"src/core/lib/compression/message_compress.h",
"src/core/lib/debug/trace.h",
@@ -648,6 +648,23 @@ cc_library(
"src/core/ext/census/operation.c",
"src/core/ext/census/placeholders.c",
"src/core/ext/census/tracing.c",
+ "src/core/ext/client_config/channel_connectivity.c",
+ "src/core/ext/client_config/client_channel.c",
+ "src/core/ext/client_config/client_channel_factory.c",
+ "src/core/ext/client_config/client_config.c",
+ "src/core/ext/client_config/connector.c",
+ "src/core/ext/client_config/default_initial_connect_string.c",
+ "src/core/ext/client_config/initial_connect_string.c",
+ "src/core/ext/client_config/lb_policy.c",
+ "src/core/ext/client_config/lb_policy_factory.c",
+ "src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/resolver.c",
+ "src/core/ext/client_config/resolver_factory.c",
+ "src/core/ext/client_config/resolver_registry.c",
+ "src/core/ext/client_config/subchannel.c",
+ "src/core/ext/client_config/subchannel_call_holder.c",
+ "src/core/ext/client_config/subchannel_index.c",
+ "src/core/ext/client_config/uri_parser.c",
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c",
"src/core/ext/lb_policy/pick_first/pick_first.c",
@@ -680,26 +697,10 @@ cc_library(
"src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_stack.c",
"src/core/lib/channel/channel_stack_builder.c",
- "src/core/lib/channel/client_channel.c",
"src/core/lib/channel/compress_filter.c",
"src/core/lib/channel/connected_channel.c",
"src/core/lib/channel/http_client_filter.c",
"src/core/lib/channel/http_server_filter.c",
- "src/core/lib/channel/subchannel_call_holder.c",
- "src/core/lib/client_config/client_config.c",
- "src/core/lib/client_config/connector.c",
- "src/core/lib/client_config/default_initial_connect_string.c",
- "src/core/lib/client_config/initial_connect_string.c",
- "src/core/lib/client_config/lb_policy.c",
- "src/core/lib/client_config/lb_policy_factory.c",
- "src/core/lib/client_config/lb_policy_registry.c",
- "src/core/lib/client_config/resolver.c",
- "src/core/lib/client_config/resolver_factory.c",
- "src/core/lib/client_config/resolver_registry.c",
- "src/core/lib/client_config/subchannel.c",
- "src/core/lib/client_config/subchannel_factory.c",
- "src/core/lib/client_config/subchannel_index.c",
- "src/core/lib/client_config/uri_parser.c",
"src/core/lib/compression/compression_algorithm.c",
"src/core/lib/compression/message_compress.c",
"src/core/lib/debug/trace.c",
@@ -757,7 +758,6 @@ cc_library(
"src/core/lib/surface/call_details.c",
"src/core/lib/surface/call_log_batch.c",
"src/core/lib/surface/channel.c",
- "src/core/lib/surface/channel_connectivity.c",
"src/core/lib/surface/channel_init.c",
"src/core/lib/surface/channel_ping.c",
"src/core/lib/surface/channel_stack_type.c",
@@ -1353,6 +1353,23 @@ objc_library(
"src/core/ext/census/operation.c",
"src/core/ext/census/placeholders.c",
"src/core/ext/census/tracing.c",
+ "src/core/ext/client_config/channel_connectivity.c",
+ "src/core/ext/client_config/client_channel.c",
+ "src/core/ext/client_config/client_channel_factory.c",
+ "src/core/ext/client_config/client_config.c",
+ "src/core/ext/client_config/connector.c",
+ "src/core/ext/client_config/default_initial_connect_string.c",
+ "src/core/ext/client_config/initial_connect_string.c",
+ "src/core/ext/client_config/lb_policy.c",
+ "src/core/ext/client_config/lb_policy_factory.c",
+ "src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/resolver.c",
+ "src/core/ext/client_config/resolver_factory.c",
+ "src/core/ext/client_config/resolver_registry.c",
+ "src/core/ext/client_config/subchannel.c",
+ "src/core/ext/client_config/subchannel_call_holder.c",
+ "src/core/ext/client_config/subchannel_index.c",
+ "src/core/ext/client_config/uri_parser.c",
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c",
"src/core/ext/lb_policy/pick_first/pick_first.c",
@@ -1387,26 +1404,10 @@ objc_library(
"src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_stack.c",
"src/core/lib/channel/channel_stack_builder.c",
- "src/core/lib/channel/client_channel.c",
"src/core/lib/channel/compress_filter.c",
"src/core/lib/channel/connected_channel.c",
"src/core/lib/channel/http_client_filter.c",
"src/core/lib/channel/http_server_filter.c",
- "src/core/lib/channel/subchannel_call_holder.c",
- "src/core/lib/client_config/client_config.c",
- "src/core/lib/client_config/connector.c",
- "src/core/lib/client_config/default_initial_connect_string.c",
- "src/core/lib/client_config/initial_connect_string.c",
- "src/core/lib/client_config/lb_policy.c",
- "src/core/lib/client_config/lb_policy_factory.c",
- "src/core/lib/client_config/lb_policy_registry.c",
- "src/core/lib/client_config/resolver.c",
- "src/core/lib/client_config/resolver_factory.c",
- "src/core/lib/client_config/resolver_registry.c",
- "src/core/lib/client_config/subchannel.c",
- "src/core/lib/client_config/subchannel_factory.c",
- "src/core/lib/client_config/subchannel_index.c",
- "src/core/lib/client_config/uri_parser.c",
"src/core/lib/compression/compression_algorithm.c",
"src/core/lib/compression/message_compress.c",
"src/core/lib/debug/trace.c",
@@ -1479,7 +1480,6 @@ objc_library(
"src/core/lib/surface/call_details.c",
"src/core/lib/surface/call_log_batch.c",
"src/core/lib/surface/channel.c",
- "src/core/lib/surface/channel_connectivity.c",
"src/core/lib/surface/channel_init.c",
"src/core/lib/surface/channel_ping.c",
"src/core/lib/surface/channel_stack_type.c",
@@ -1524,6 +1524,21 @@ objc_library(
"src/core/ext/census/grpc_filter.h",
"src/core/ext/census/mlog.h",
"src/core/ext/census/rpc_metric_id.h",
+ "src/core/ext/client_config/client_channel.h",
+ "src/core/ext/client_config/client_channel_factory.h",
+ "src/core/ext/client_config/client_config.h",
+ "src/core/ext/client_config/connector.h",
+ "src/core/ext/client_config/initial_connect_string.h",
+ "src/core/ext/client_config/lb_policy.h",
+ "src/core/ext/client_config/lb_policy_factory.h",
+ "src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/resolver.h",
+ "src/core/ext/client_config/resolver_factory.h",
+ "src/core/ext/client_config/resolver_registry.h",
+ "src/core/ext/client_config/subchannel.h",
+ "src/core/ext/client_config/subchannel_call_holder.h",
+ "src/core/ext/client_config/subchannel_index.h",
+ "src/core/ext/client_config/uri_parser.h",
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/ext/transport/chttp2/transport/alpn.h",
@@ -1550,26 +1565,11 @@ objc_library(
"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/client_channel.h",
"src/core/lib/channel/compress_filter.h",
"src/core/lib/channel/connected_channel.h",
"src/core/lib/channel/context.h",
"src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.h",
- "src/core/lib/channel/subchannel_call_holder.h",
- "src/core/lib/client_config/client_config.h",
- "src/core/lib/client_config/connector.h",
- "src/core/lib/client_config/initial_connect_string.h",
- "src/core/lib/client_config/lb_policy.h",
- "src/core/lib/client_config/lb_policy_factory.h",
- "src/core/lib/client_config/lb_policy_registry.h",
- "src/core/lib/client_config/resolver.h",
- "src/core/lib/client_config/resolver_factory.h",
- "src/core/lib/client_config/resolver_registry.h",
- "src/core/lib/client_config/subchannel.h",
- "src/core/lib/client_config/subchannel_factory.h",
- "src/core/lib/client_config/subchannel_index.h",
- "src/core/lib/client_config/uri_parser.h",
"src/core/lib/compression/algorithm_metadata.h",
"src/core/lib/compression/message_compress.h",
"src/core/lib/debug/trace.h",
diff --git a/Makefile b/Makefile
index 18f17384e5..6df46a758d 100644
--- a/Makefile
+++ b/Makefile
@@ -2460,6 +2460,23 @@ LIBGRPC_SRC = \
src/core/ext/census/operation.c \
src/core/ext/census/placeholders.c \
src/core/ext/census/tracing.c \
+ src/core/ext/client_config/channel_connectivity.c \
+ src/core/ext/client_config/client_channel.c \
+ src/core/ext/client_config/client_channel_factory.c \
+ src/core/ext/client_config/client_config.c \
+ src/core/ext/client_config/connector.c \
+ src/core/ext/client_config/default_initial_connect_string.c \
+ src/core/ext/client_config/initial_connect_string.c \
+ src/core/ext/client_config/lb_policy.c \
+ src/core/ext/client_config/lb_policy_factory.c \
+ src/core/ext/client_config/lb_policy_registry.c \
+ src/core/ext/client_config/resolver.c \
+ src/core/ext/client_config/resolver_factory.c \
+ src/core/ext/client_config/resolver_registry.c \
+ src/core/ext/client_config/subchannel.c \
+ src/core/ext/client_config/subchannel_call_holder.c \
+ src/core/ext/client_config/subchannel_index.c \
+ src/core/ext/client_config/uri_parser.c \
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \
src/core/ext/lb_policy/pick_first/pick_first.c \
@@ -2494,26 +2511,10 @@ LIBGRPC_SRC = \
src/core/lib/channel/channel_args.c \
src/core/lib/channel/channel_stack.c \
src/core/lib/channel/channel_stack_builder.c \
- src/core/lib/channel/client_channel.c \
src/core/lib/channel/compress_filter.c \
src/core/lib/channel/connected_channel.c \
src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \
- src/core/lib/channel/subchannel_call_holder.c \
- src/core/lib/client_config/client_config.c \
- src/core/lib/client_config/connector.c \
- src/core/lib/client_config/default_initial_connect_string.c \
- src/core/lib/client_config/initial_connect_string.c \
- src/core/lib/client_config/lb_policy.c \
- src/core/lib/client_config/lb_policy_factory.c \
- src/core/lib/client_config/lb_policy_registry.c \
- src/core/lib/client_config/resolver.c \
- src/core/lib/client_config/resolver_factory.c \
- src/core/lib/client_config/resolver_registry.c \
- src/core/lib/client_config/subchannel.c \
- src/core/lib/client_config/subchannel_factory.c \
- src/core/lib/client_config/subchannel_index.c \
- src/core/lib/client_config/uri_parser.c \
src/core/lib/compression/compression_algorithm.c \
src/core/lib/compression/message_compress.c \
src/core/lib/debug/trace.c \
@@ -2586,7 +2587,6 @@ LIBGRPC_SRC = \
src/core/lib/surface/call_details.c \
src/core/lib/surface/call_log_batch.c \
src/core/lib/surface/channel.c \
- src/core/lib/surface/channel_connectivity.c \
src/core/lib/surface/channel_init.c \
src/core/lib/surface/channel_ping.c \
src/core/lib/surface/channel_stack_type.c \
@@ -2821,6 +2821,23 @@ LIBGRPC_UNSECURE_SRC = \
src/core/ext/census/operation.c \
src/core/ext/census/placeholders.c \
src/core/ext/census/tracing.c \
+ src/core/ext/client_config/channel_connectivity.c \
+ src/core/ext/client_config/client_channel.c \
+ src/core/ext/client_config/client_channel_factory.c \
+ src/core/ext/client_config/client_config.c \
+ src/core/ext/client_config/connector.c \
+ src/core/ext/client_config/default_initial_connect_string.c \
+ src/core/ext/client_config/initial_connect_string.c \
+ src/core/ext/client_config/lb_policy.c \
+ src/core/ext/client_config/lb_policy_factory.c \
+ src/core/ext/client_config/lb_policy_registry.c \
+ src/core/ext/client_config/resolver.c \
+ src/core/ext/client_config/resolver_factory.c \
+ src/core/ext/client_config/resolver_registry.c \
+ src/core/ext/client_config/subchannel.c \
+ src/core/ext/client_config/subchannel_call_holder.c \
+ src/core/ext/client_config/subchannel_index.c \
+ src/core/ext/client_config/uri_parser.c \
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \
src/core/ext/lb_policy/pick_first/pick_first.c \
@@ -2853,26 +2870,10 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/channel/channel_args.c \
src/core/lib/channel/channel_stack.c \
src/core/lib/channel/channel_stack_builder.c \
- src/core/lib/channel/client_channel.c \
src/core/lib/channel/compress_filter.c \
src/core/lib/channel/connected_channel.c \
src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \
- src/core/lib/channel/subchannel_call_holder.c \
- src/core/lib/client_config/client_config.c \
- src/core/lib/client_config/connector.c \
- src/core/lib/client_config/default_initial_connect_string.c \
- src/core/lib/client_config/initial_connect_string.c \
- src/core/lib/client_config/lb_policy.c \
- src/core/lib/client_config/lb_policy_factory.c \
- src/core/lib/client_config/lb_policy_registry.c \
- src/core/lib/client_config/resolver.c \
- src/core/lib/client_config/resolver_factory.c \
- src/core/lib/client_config/resolver_registry.c \
- src/core/lib/client_config/subchannel.c \
- src/core/lib/client_config/subchannel_factory.c \
- src/core/lib/client_config/subchannel_index.c \
- src/core/lib/client_config/uri_parser.c \
src/core/lib/compression/compression_algorithm.c \
src/core/lib/compression/message_compress.c \
src/core/lib/debug/trace.c \
@@ -2930,7 +2931,6 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/surface/call_details.c \
src/core/lib/surface/call_log_batch.c \
src/core/lib/surface/channel.c \
- src/core/lib/surface/channel_connectivity.c \
src/core/lib/surface/channel_init.c \
src/core/lib/surface/channel_ping.c \
src/core/lib/surface/channel_stack_type.c \
diff --git a/README.md b/README.md
index abb4905392..3ee2b9f5ca 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
[![Join the chat at https://gitter.im/grpc/grpc](https://badges.gitter.im/grpc/grpc.svg)](https://gitter.im/grpc/grpc?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-Copyright 2015-2016 Google Inc.
+Copyright 2015 Google Inc.
#Documentation
diff --git a/binding.gyp b/binding.gyp
index 8b987fefa8..d6d559dd58 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -567,6 +567,23 @@
'src/core/ext/census/operation.c',
'src/core/ext/census/placeholders.c',
'src/core/ext/census/tracing.c',
+ 'src/core/ext/client_config/channel_connectivity.c',
+ 'src/core/ext/client_config/client_channel.c',
+ 'src/core/ext/client_config/client_channel_factory.c',
+ 'src/core/ext/client_config/client_config.c',
+ 'src/core/ext/client_config/connector.c',
+ 'src/core/ext/client_config/default_initial_connect_string.c',
+ 'src/core/ext/client_config/initial_connect_string.c',
+ 'src/core/ext/client_config/lb_policy.c',
+ 'src/core/ext/client_config/lb_policy_factory.c',
+ 'src/core/ext/client_config/lb_policy_registry.c',
+ 'src/core/ext/client_config/resolver.c',
+ 'src/core/ext/client_config/resolver_factory.c',
+ 'src/core/ext/client_config/resolver_registry.c',
+ 'src/core/ext/client_config/subchannel.c',
+ 'src/core/ext/client_config/subchannel_call_holder.c',
+ 'src/core/ext/client_config/subchannel_index.c',
+ 'src/core/ext/client_config/uri_parser.c',
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c',
'src/core/ext/lb_policy/pick_first/pick_first.c',
@@ -601,26 +618,10 @@
'src/core/lib/channel/channel_args.c',
'src/core/lib/channel/channel_stack.c',
'src/core/lib/channel/channel_stack_builder.c',
- 'src/core/lib/channel/client_channel.c',
'src/core/lib/channel/compress_filter.c',
'src/core/lib/channel/connected_channel.c',
'src/core/lib/channel/http_client_filter.c',
'src/core/lib/channel/http_server_filter.c',
- 'src/core/lib/channel/subchannel_call_holder.c',
- 'src/core/lib/client_config/client_config.c',
- 'src/core/lib/client_config/connector.c',
- 'src/core/lib/client_config/default_initial_connect_string.c',
- 'src/core/lib/client_config/initial_connect_string.c',
- 'src/core/lib/client_config/lb_policy.c',
- 'src/core/lib/client_config/lb_policy_factory.c',
- 'src/core/lib/client_config/lb_policy_registry.c',
- 'src/core/lib/client_config/resolver.c',
- 'src/core/lib/client_config/resolver_factory.c',
- 'src/core/lib/client_config/resolver_registry.c',
- 'src/core/lib/client_config/subchannel.c',
- 'src/core/lib/client_config/subchannel_factory.c',
- 'src/core/lib/client_config/subchannel_index.c',
- 'src/core/lib/client_config/uri_parser.c',
'src/core/lib/compression/compression_algorithm.c',
'src/core/lib/compression/message_compress.c',
'src/core/lib/debug/trace.c',
@@ -693,7 +694,6 @@
'src/core/lib/surface/call_details.c',
'src/core/lib/surface/call_log_batch.c',
'src/core/lib/surface/channel.c',
- 'src/core/lib/surface/channel_connectivity.c',
'src/core/lib/surface/channel_init.c',
'src/core/lib/surface/channel_ping.c',
'src/core/lib/surface/channel_stack_type.c',
diff --git a/build.yaml b/build.yaml
index ab4896a4bb..66d9a021eb 100644
--- a/build.yaml
+++ b/build.yaml
@@ -257,26 +257,11 @@ filegroups:
- 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/client_channel.h
- src/core/lib/channel/compress_filter.h
- src/core/lib/channel/connected_channel.h
- src/core/lib/channel/context.h
- src/core/lib/channel/http_client_filter.h
- src/core/lib/channel/http_server_filter.h
- - src/core/lib/channel/subchannel_call_holder.h
- - src/core/lib/client_config/client_config.h
- - src/core/lib/client_config/connector.h
- - src/core/lib/client_config/initial_connect_string.h
- - src/core/lib/client_config/lb_policy.h
- - src/core/lib/client_config/lb_policy_factory.h
- - src/core/lib/client_config/lb_policy_registry.h
- - src/core/lib/client_config/resolver.h
- - src/core/lib/client_config/resolver_factory.h
- - src/core/lib/client_config/resolver_registry.h
- - src/core/lib/client_config/subchannel.h
- - src/core/lib/client_config/subchannel_factory.h
- - src/core/lib/client_config/subchannel_index.h
- - src/core/lib/client_config/uri_parser.h
- src/core/lib/compression/algorithm_metadata.h
- src/core/lib/compression/message_compress.h
- src/core/lib/debug/trace.h
@@ -346,26 +331,10 @@ filegroups:
- src/core/lib/channel/channel_args.c
- src/core/lib/channel/channel_stack.c
- src/core/lib/channel/channel_stack_builder.c
- - src/core/lib/channel/client_channel.c
- src/core/lib/channel/compress_filter.c
- src/core/lib/channel/connected_channel.c
- src/core/lib/channel/http_client_filter.c
- src/core/lib/channel/http_server_filter.c
- - src/core/lib/channel/subchannel_call_holder.c
- - src/core/lib/client_config/client_config.c
- - src/core/lib/client_config/connector.c
- - src/core/lib/client_config/default_initial_connect_string.c
- - src/core/lib/client_config/initial_connect_string.c
- - src/core/lib/client_config/lb_policy.c
- - src/core/lib/client_config/lb_policy_factory.c
- - src/core/lib/client_config/lb_policy_registry.c
- - src/core/lib/client_config/resolver.c
- - src/core/lib/client_config/resolver_factory.c
- - src/core/lib/client_config/resolver_registry.c
- - src/core/lib/client_config/subchannel.c
- - src/core/lib/client_config/subchannel_factory.c
- - src/core/lib/client_config/subchannel_index.c
- - src/core/lib/client_config/uri_parser.c
- src/core/lib/compression/compression_algorithm.c
- src/core/lib/compression/message_compress.c
- src/core/lib/debug/trace.c
@@ -423,7 +392,6 @@ filegroups:
- src/core/lib/surface/call_details.c
- src/core/lib/surface/call_log_batch.c
- src/core/lib/surface/channel.c
- - src/core/lib/surface/channel_connectivity.c
- src/core/lib/surface/channel_init.c
- src/core/lib/surface/channel_ping.c
- src/core/lib/surface/channel_stack_type.c
@@ -442,6 +410,41 @@ filegroups:
- src/core/lib/transport/static_metadata.c
- src/core/lib/transport/transport.c
- src/core/lib/transport/transport_op_string.c
+- name: grpc_client_config
+ headers:
+ - src/core/ext/client_config/client_channel.h
+ - src/core/ext/client_config/client_channel_factory.h
+ - src/core/ext/client_config/client_config.h
+ - src/core/ext/client_config/connector.h
+ - src/core/ext/client_config/initial_connect_string.h
+ - src/core/ext/client_config/lb_policy.h
+ - src/core/ext/client_config/lb_policy_factory.h
+ - src/core/ext/client_config/lb_policy_registry.h
+ - src/core/ext/client_config/resolver.h
+ - src/core/ext/client_config/resolver_factory.h
+ - src/core/ext/client_config/resolver_registry.h
+ - src/core/ext/client_config/subchannel.h
+ - src/core/ext/client_config/subchannel_call_holder.h
+ - src/core/ext/client_config/subchannel_index.h
+ - src/core/ext/client_config/uri_parser.h
+ src:
+ - src/core/ext/client_config/channel_connectivity.c
+ - src/core/ext/client_config/client_channel.c
+ - src/core/ext/client_config/client_channel_factory.c
+ - src/core/ext/client_config/client_config.c
+ - src/core/ext/client_config/connector.c
+ - src/core/ext/client_config/default_initial_connect_string.c
+ - src/core/ext/client_config/initial_connect_string.c
+ - src/core/ext/client_config/lb_policy.c
+ - src/core/ext/client_config/lb_policy_factory.c
+ - src/core/ext/client_config/lb_policy_registry.c
+ - src/core/ext/client_config/resolver.c
+ - src/core/ext/client_config/resolver_factory.c
+ - src/core/ext/client_config/resolver_registry.c
+ - src/core/ext/client_config/subchannel.c
+ - src/core/ext/client_config/subchannel_call_holder.c
+ - src/core/ext/client_config/subchannel_index.c
+ - src/core/ext/client_config/uri_parser.c
- name: grpc_codegen
public_headers:
- include/grpc/impl/codegen/byte_buffer.h
@@ -459,30 +462,35 @@ filegroups:
- src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c
uses:
- grpc_base
+ - grpc_client_config
- name: grpc_lb_policy_pick_first
src:
- src/core/ext/lb_policy/pick_first/pick_first.c
plugin: grpc_lb_policy_pick_first
uses:
- grpc_base
+ - grpc_client_config
- name: grpc_lb_policy_round_robin
src:
- src/core/ext/lb_policy/round_robin/round_robin.c
plugin: grpc_lb_policy_round_robin
uses:
- grpc_base
+ - grpc_client_config
- name: grpc_resolver_dns_native
src:
- src/core/ext/resolver/dns/native/dns_resolver.c
plugin: grpc_resolver_dns_native
uses:
- grpc_base
+ - grpc_client_config
- name: grpc_resolver_sockaddr
src:
- src/core/ext/resolver/sockaddr/sockaddr_resolver.c
plugin: grpc_resolver_sockaddr
uses:
- grpc_base
+ - grpc_client_config
- name: grpc_secure
headers:
- src/core/lib/security/auth_filters.h
diff --git a/config.m4 b/config.m4
index 9abd8cebb8..dae142dd40 100644
--- a/config.m4
+++ b/config.m4
@@ -89,6 +89,23 @@ if test "$PHP_GRPC" != "no"; then
src/core/ext/census/operation.c \
src/core/ext/census/placeholders.c \
src/core/ext/census/tracing.c \
+ src/core/ext/client_config/channel_connectivity.c \
+ src/core/ext/client_config/client_channel.c \
+ src/core/ext/client_config/client_channel_factory.c \
+ src/core/ext/client_config/client_config.c \
+ src/core/ext/client_config/connector.c \
+ src/core/ext/client_config/default_initial_connect_string.c \
+ src/core/ext/client_config/initial_connect_string.c \
+ src/core/ext/client_config/lb_policy.c \
+ src/core/ext/client_config/lb_policy_factory.c \
+ src/core/ext/client_config/lb_policy_registry.c \
+ src/core/ext/client_config/resolver.c \
+ src/core/ext/client_config/resolver_factory.c \
+ src/core/ext/client_config/resolver_registry.c \
+ src/core/ext/client_config/subchannel.c \
+ src/core/ext/client_config/subchannel_call_holder.c \
+ src/core/ext/client_config/subchannel_index.c \
+ src/core/ext/client_config/uri_parser.c \
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \
src/core/ext/lb_policy/pick_first/pick_first.c \
@@ -123,26 +140,10 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/channel/channel_args.c \
src/core/lib/channel/channel_stack.c \
src/core/lib/channel/channel_stack_builder.c \
- src/core/lib/channel/client_channel.c \
src/core/lib/channel/compress_filter.c \
src/core/lib/channel/connected_channel.c \
src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \
- src/core/lib/channel/subchannel_call_holder.c \
- src/core/lib/client_config/client_config.c \
- src/core/lib/client_config/connector.c \
- src/core/lib/client_config/default_initial_connect_string.c \
- src/core/lib/client_config/initial_connect_string.c \
- src/core/lib/client_config/lb_policy.c \
- src/core/lib/client_config/lb_policy_factory.c \
- src/core/lib/client_config/lb_policy_registry.c \
- src/core/lib/client_config/resolver.c \
- src/core/lib/client_config/resolver_factory.c \
- src/core/lib/client_config/resolver_registry.c \
- src/core/lib/client_config/subchannel.c \
- src/core/lib/client_config/subchannel_factory.c \
- src/core/lib/client_config/subchannel_index.c \
- src/core/lib/client_config/uri_parser.c \
src/core/lib/compression/compression_algorithm.c \
src/core/lib/compression/message_compress.c \
src/core/lib/debug/trace.c \
@@ -215,7 +216,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/surface/call_details.c \
src/core/lib/surface/call_log_batch.c \
src/core/lib/surface/channel.c \
- src/core/lib/surface/channel_connectivity.c \
src/core/lib/surface/channel_init.c \
src/core/lib/surface/channel_ping.c \
src/core/lib/surface/channel_stack_type.c \
@@ -545,6 +545,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/boringssl)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/census)
+ PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/client_config)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/lb_policy/pick_first)
@@ -557,7 +558,6 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/server/secure)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/ext/transport/chttp2/transport)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/channel)
- PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/client_config)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/compression)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/debug)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/http)
diff --git a/gRPC.podspec b/gRPC.podspec
index 7e0e44f3dd..93346df382 100644
--- a/gRPC.podspec
+++ b/gRPC.podspec
@@ -167,6 +167,21 @@ Pod::Spec.new do |s|
'src/core/ext/census/grpc_filter.h',
'src/core/ext/census/mlog.h',
'src/core/ext/census/rpc_metric_id.h',
+ 'src/core/ext/client_config/client_channel.h',
+ 'src/core/ext/client_config/client_channel_factory.h',
+ 'src/core/ext/client_config/client_config.h',
+ 'src/core/ext/client_config/connector.h',
+ 'src/core/ext/client_config/initial_connect_string.h',
+ 'src/core/ext/client_config/lb_policy.h',
+ 'src/core/ext/client_config/lb_policy_factory.h',
+ 'src/core/ext/client_config/lb_policy_registry.h',
+ 'src/core/ext/client_config/resolver.h',
+ 'src/core/ext/client_config/resolver_factory.h',
+ 'src/core/ext/client_config/resolver_registry.h',
+ 'src/core/ext/client_config/subchannel.h',
+ 'src/core/ext/client_config/subchannel_call_holder.h',
+ 'src/core/ext/client_config/subchannel_index.h',
+ 'src/core/ext/client_config/uri_parser.h',
'src/core/ext/lb_policy/grpclb/load_balancer_api.h',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h',
'src/core/ext/transport/chttp2/transport/alpn.h',
@@ -193,26 +208,11 @@ Pod::Spec.new do |s|
'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/client_channel.h',
'src/core/lib/channel/compress_filter.h',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/context.h',
'src/core/lib/channel/http_client_filter.h',
'src/core/lib/channel/http_server_filter.h',
- 'src/core/lib/channel/subchannel_call_holder.h',
- 'src/core/lib/client_config/client_config.h',
- 'src/core/lib/client_config/connector.h',
- 'src/core/lib/client_config/initial_connect_string.h',
- 'src/core/lib/client_config/lb_policy.h',
- 'src/core/lib/client_config/lb_policy_factory.h',
- 'src/core/lib/client_config/lb_policy_registry.h',
- 'src/core/lib/client_config/resolver.h',
- 'src/core/lib/client_config/resolver_factory.h',
- 'src/core/lib/client_config/resolver_registry.h',
- 'src/core/lib/client_config/subchannel.h',
- 'src/core/lib/client_config/subchannel_factory.h',
- 'src/core/lib/client_config/subchannel_index.h',
- 'src/core/lib/client_config/uri_parser.h',
'src/core/lib/compression/algorithm_metadata.h',
'src/core/lib/compression/message_compress.h',
'src/core/lib/debug/trace.h',
@@ -318,6 +318,23 @@ Pod::Spec.new do |s|
'src/core/ext/census/operation.c',
'src/core/ext/census/placeholders.c',
'src/core/ext/census/tracing.c',
+ 'src/core/ext/client_config/channel_connectivity.c',
+ 'src/core/ext/client_config/client_channel.c',
+ 'src/core/ext/client_config/client_channel_factory.c',
+ 'src/core/ext/client_config/client_config.c',
+ 'src/core/ext/client_config/connector.c',
+ 'src/core/ext/client_config/default_initial_connect_string.c',
+ 'src/core/ext/client_config/initial_connect_string.c',
+ 'src/core/ext/client_config/lb_policy.c',
+ 'src/core/ext/client_config/lb_policy_factory.c',
+ 'src/core/ext/client_config/lb_policy_registry.c',
+ 'src/core/ext/client_config/resolver.c',
+ 'src/core/ext/client_config/resolver_factory.c',
+ 'src/core/ext/client_config/resolver_registry.c',
+ 'src/core/ext/client_config/subchannel.c',
+ 'src/core/ext/client_config/subchannel_call_holder.c',
+ 'src/core/ext/client_config/subchannel_index.c',
+ 'src/core/ext/client_config/uri_parser.c',
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c',
'src/core/ext/lb_policy/pick_first/pick_first.c',
@@ -352,26 +369,10 @@ Pod::Spec.new do |s|
'src/core/lib/channel/channel_args.c',
'src/core/lib/channel/channel_stack.c',
'src/core/lib/channel/channel_stack_builder.c',
- 'src/core/lib/channel/client_channel.c',
'src/core/lib/channel/compress_filter.c',
'src/core/lib/channel/connected_channel.c',
'src/core/lib/channel/http_client_filter.c',
'src/core/lib/channel/http_server_filter.c',
- 'src/core/lib/channel/subchannel_call_holder.c',
- 'src/core/lib/client_config/client_config.c',
- 'src/core/lib/client_config/connector.c',
- 'src/core/lib/client_config/default_initial_connect_string.c',
- 'src/core/lib/client_config/initial_connect_string.c',
- 'src/core/lib/client_config/lb_policy.c',
- 'src/core/lib/client_config/lb_policy_factory.c',
- 'src/core/lib/client_config/lb_policy_registry.c',
- 'src/core/lib/client_config/resolver.c',
- 'src/core/lib/client_config/resolver_factory.c',
- 'src/core/lib/client_config/resolver_registry.c',
- 'src/core/lib/client_config/subchannel.c',
- 'src/core/lib/client_config/subchannel_factory.c',
- 'src/core/lib/client_config/subchannel_index.c',
- 'src/core/lib/client_config/uri_parser.c',
'src/core/lib/compression/compression_algorithm.c',
'src/core/lib/compression/message_compress.c',
'src/core/lib/debug/trace.c',
@@ -444,7 +445,6 @@ Pod::Spec.new do |s|
'src/core/lib/surface/call_details.c',
'src/core/lib/surface/call_log_batch.c',
'src/core/lib/surface/channel.c',
- 'src/core/lib/surface/channel_connectivity.c',
'src/core/lib/surface/channel_init.c',
'src/core/lib/surface/channel_ping.c',
'src/core/lib/surface/channel_stack_type.c',
@@ -490,6 +490,21 @@ Pod::Spec.new do |s|
'src/core/ext/census/grpc_filter.h',
'src/core/ext/census/mlog.h',
'src/core/ext/census/rpc_metric_id.h',
+ 'src/core/ext/client_config/client_channel.h',
+ 'src/core/ext/client_config/client_channel_factory.h',
+ 'src/core/ext/client_config/client_config.h',
+ 'src/core/ext/client_config/connector.h',
+ 'src/core/ext/client_config/initial_connect_string.h',
+ 'src/core/ext/client_config/lb_policy.h',
+ 'src/core/ext/client_config/lb_policy_factory.h',
+ 'src/core/ext/client_config/lb_policy_registry.h',
+ 'src/core/ext/client_config/resolver.h',
+ 'src/core/ext/client_config/resolver_factory.h',
+ 'src/core/ext/client_config/resolver_registry.h',
+ 'src/core/ext/client_config/subchannel.h',
+ 'src/core/ext/client_config/subchannel_call_holder.h',
+ 'src/core/ext/client_config/subchannel_index.h',
+ 'src/core/ext/client_config/uri_parser.h',
'src/core/ext/lb_policy/grpclb/load_balancer_api.h',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h',
'src/core/ext/transport/chttp2/transport/alpn.h',
@@ -516,26 +531,11 @@ Pod::Spec.new do |s|
'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/client_channel.h',
'src/core/lib/channel/compress_filter.h',
'src/core/lib/channel/connected_channel.h',
'src/core/lib/channel/context.h',
'src/core/lib/channel/http_client_filter.h',
'src/core/lib/channel/http_server_filter.h',
- 'src/core/lib/channel/subchannel_call_holder.h',
- 'src/core/lib/client_config/client_config.h',
- 'src/core/lib/client_config/connector.h',
- 'src/core/lib/client_config/initial_connect_string.h',
- 'src/core/lib/client_config/lb_policy.h',
- 'src/core/lib/client_config/lb_policy_factory.h',
- 'src/core/lib/client_config/lb_policy_registry.h',
- 'src/core/lib/client_config/resolver.h',
- 'src/core/lib/client_config/resolver_factory.h',
- 'src/core/lib/client_config/resolver_registry.h',
- 'src/core/lib/client_config/subchannel.h',
- 'src/core/lib/client_config/subchannel_factory.h',
- 'src/core/lib/client_config/subchannel_index.h',
- 'src/core/lib/client_config/uri_parser.h',
'src/core/lib/compression/algorithm_metadata.h',
'src/core/lib/compression/message_compress.h',
'src/core/lib/debug/trace.h',
diff --git a/grpc.gemspec b/grpc.gemspec
index d1e7ad2b31..03192c42dd 100755
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -163,6 +163,21 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/census/grpc_filter.h )
s.files += %w( src/core/ext/census/mlog.h )
s.files += %w( src/core/ext/census/rpc_metric_id.h )
+ s.files += %w( src/core/ext/client_config/client_channel.h )
+ s.files += %w( src/core/ext/client_config/client_channel_factory.h )
+ s.files += %w( src/core/ext/client_config/client_config.h )
+ s.files += %w( src/core/ext/client_config/connector.h )
+ s.files += %w( src/core/ext/client_config/initial_connect_string.h )
+ s.files += %w( src/core/ext/client_config/lb_policy.h )
+ s.files += %w( src/core/ext/client_config/lb_policy_factory.h )
+ s.files += %w( src/core/ext/client_config/lb_policy_registry.h )
+ s.files += %w( src/core/ext/client_config/resolver.h )
+ s.files += %w( src/core/ext/client_config/resolver_factory.h )
+ s.files += %w( src/core/ext/client_config/resolver_registry.h )
+ s.files += %w( src/core/ext/client_config/subchannel.h )
+ s.files += %w( src/core/ext/client_config/subchannel_call_holder.h )
+ s.files += %w( src/core/ext/client_config/subchannel_index.h )
+ s.files += %w( src/core/ext/client_config/uri_parser.h )
s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.h )
s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h )
s.files += %w( src/core/ext/transport/chttp2/transport/alpn.h )
@@ -189,26 +204,11 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/channel/channel_args.h )
s.files += %w( src/core/lib/channel/channel_stack.h )
s.files += %w( src/core/lib/channel/channel_stack_builder.h )
- s.files += %w( src/core/lib/channel/client_channel.h )
s.files += %w( src/core/lib/channel/compress_filter.h )
s.files += %w( src/core/lib/channel/connected_channel.h )
s.files += %w( src/core/lib/channel/context.h )
s.files += %w( src/core/lib/channel/http_client_filter.h )
s.files += %w( src/core/lib/channel/http_server_filter.h )
- s.files += %w( src/core/lib/channel/subchannel_call_holder.h )
- s.files += %w( src/core/lib/client_config/client_config.h )
- s.files += %w( src/core/lib/client_config/connector.h )
- s.files += %w( src/core/lib/client_config/initial_connect_string.h )
- s.files += %w( src/core/lib/client_config/lb_policy.h )
- s.files += %w( src/core/lib/client_config/lb_policy_factory.h )
- s.files += %w( src/core/lib/client_config/lb_policy_registry.h )
- s.files += %w( src/core/lib/client_config/resolver.h )
- s.files += %w( src/core/lib/client_config/resolver_factory.h )
- s.files += %w( src/core/lib/client_config/resolver_registry.h )
- s.files += %w( src/core/lib/client_config/subchannel.h )
- s.files += %w( src/core/lib/client_config/subchannel_factory.h )
- s.files += %w( src/core/lib/client_config/subchannel_index.h )
- s.files += %w( src/core/lib/client_config/uri_parser.h )
s.files += %w( src/core/lib/compression/algorithm_metadata.h )
s.files += %w( src/core/lib/compression/message_compress.h )
s.files += %w( src/core/lib/debug/trace.h )
@@ -301,6 +301,23 @@ Gem::Specification.new do |s|
s.files += %w( src/core/ext/census/operation.c )
s.files += %w( src/core/ext/census/placeholders.c )
s.files += %w( src/core/ext/census/tracing.c )
+ s.files += %w( src/core/ext/client_config/channel_connectivity.c )
+ s.files += %w( src/core/ext/client_config/client_channel.c )
+ s.files += %w( src/core/ext/client_config/client_channel_factory.c )
+ s.files += %w( src/core/ext/client_config/client_config.c )
+ s.files += %w( src/core/ext/client_config/connector.c )
+ s.files += %w( src/core/ext/client_config/default_initial_connect_string.c )
+ s.files += %w( src/core/ext/client_config/initial_connect_string.c )
+ s.files += %w( src/core/ext/client_config/lb_policy.c )
+ s.files += %w( src/core/ext/client_config/lb_policy_factory.c )
+ s.files += %w( src/core/ext/client_config/lb_policy_registry.c )
+ s.files += %w( src/core/ext/client_config/resolver.c )
+ s.files += %w( src/core/ext/client_config/resolver_factory.c )
+ s.files += %w( src/core/ext/client_config/resolver_registry.c )
+ s.files += %w( src/core/ext/client_config/subchannel.c )
+ s.files += %w( src/core/ext/client_config/subchannel_call_holder.c )
+ s.files += %w( src/core/ext/client_config/subchannel_index.c )
+ s.files += %w( src/core/ext/client_config/uri_parser.c )
s.files += %w( src/core/ext/lb_policy/grpclb/load_balancer_api.c )
s.files += %w( src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c )
s.files += %w( src/core/ext/lb_policy/pick_first/pick_first.c )
@@ -335,26 +352,10 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/channel/channel_args.c )
s.files += %w( src/core/lib/channel/channel_stack.c )
s.files += %w( src/core/lib/channel/channel_stack_builder.c )
- s.files += %w( src/core/lib/channel/client_channel.c )
s.files += %w( src/core/lib/channel/compress_filter.c )
s.files += %w( src/core/lib/channel/connected_channel.c )
s.files += %w( src/core/lib/channel/http_client_filter.c )
s.files += %w( src/core/lib/channel/http_server_filter.c )
- s.files += %w( src/core/lib/channel/subchannel_call_holder.c )
- s.files += %w( src/core/lib/client_config/client_config.c )
- s.files += %w( src/core/lib/client_config/connector.c )
- s.files += %w( src/core/lib/client_config/default_initial_connect_string.c )
- s.files += %w( src/core/lib/client_config/initial_connect_string.c )
- s.files += %w( src/core/lib/client_config/lb_policy.c )
- s.files += %w( src/core/lib/client_config/lb_policy_factory.c )
- s.files += %w( src/core/lib/client_config/lb_policy_registry.c )
- s.files += %w( src/core/lib/client_config/resolver.c )
- s.files += %w( src/core/lib/client_config/resolver_factory.c )
- s.files += %w( src/core/lib/client_config/resolver_registry.c )
- s.files += %w( src/core/lib/client_config/subchannel.c )
- s.files += %w( src/core/lib/client_config/subchannel_factory.c )
- s.files += %w( src/core/lib/client_config/subchannel_index.c )
- s.files += %w( src/core/lib/client_config/uri_parser.c )
s.files += %w( src/core/lib/compression/compression_algorithm.c )
s.files += %w( src/core/lib/compression/message_compress.c )
s.files += %w( src/core/lib/debug/trace.c )
@@ -427,7 +428,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/surface/call_details.c )
s.files += %w( src/core/lib/surface/call_log_batch.c )
s.files += %w( src/core/lib/surface/channel.c )
- s.files += %w( src/core/lib/surface/channel_connectivity.c )
s.files += %w( src/core/lib/surface/channel_init.c )
s.files += %w( src/core/lib/surface/channel_ping.c )
s.files += %w( src/core/lib/surface/channel_stack_type.c )
diff --git a/include/grpc++/impl/codegen/async_stream.h b/include/grpc++/impl/codegen/async_stream.h
index 78fb7274e2..a607a47106 100644
--- a/include/grpc++/impl/codegen/async_stream.h
+++ b/include/grpc++/impl/codegen/async_stream.h
@@ -108,7 +108,8 @@ class ClientAsyncReader GRPC_FINAL : public ClientAsyncReaderInterface<R> {
const W& request, void* tag)
: context_(context), call_(channel->CreateCall(method, context, cq)) {
init_ops_.set_output_tag(tag);
- init_ops_.SendInitialMetadata(context->send_initial_metadata_);
+ init_ops_.SendInitialMetadata(context->send_initial_metadata_,
+ context->initial_metadata_flags());
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(init_ops_.SendMessage(request).ok());
init_ops_.ClientSendClose();
@@ -173,7 +174,8 @@ class ClientAsyncWriter GRPC_FINAL : public ClientAsyncWriterInterface<W> {
finish_ops_.RecvMessage(response);
init_ops_.set_output_tag(tag);
- init_ops_.SendInitialMetadata(context->send_initial_metadata_);
+ init_ops_.SendInitialMetadata(context->send_initial_metadata_,
+ context->initial_metadata_flags());
call_.PerformOps(&init_ops_);
}
@@ -240,7 +242,8 @@ class ClientAsyncReaderWriter GRPC_FINAL
void* tag)
: context_(context), call_(channel->CreateCall(method, context, cq)) {
init_ops_.set_output_tag(tag);
- init_ops_.SendInitialMetadata(context->send_initial_metadata_);
+ init_ops_.SendInitialMetadata(context->send_initial_metadata_,
+ context->initial_metadata_flags());
call_.PerformOps(&init_ops_);
}
@@ -305,7 +308,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
- meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
call_.PerformOps(&meta_ops_);
}
@@ -319,7 +323,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
void Finish(const W& msg, const Status& status, void* tag) {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
- finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
// The response is dropped if the status is not OK.
@@ -336,7 +341,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface,
GPR_CODEGEN_ASSERT(!status.ok());
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
- finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
@@ -366,7 +372,8 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
- meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
call_.PerformOps(&meta_ops_);
}
@@ -374,7 +381,8 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
- write_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
// TODO(ctiller): don't assert
@@ -385,7 +393,8 @@ class ServerAsyncWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
void Finish(const Status& status, void* tag) {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
- finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
@@ -415,7 +424,8 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_ops_.set_output_tag(tag);
- meta_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ meta_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
call_.PerformOps(&meta_ops_);
}
@@ -429,7 +439,8 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
void Write(const W& msg, void* tag) GRPC_OVERRIDE {
write_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
- write_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ write_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
// TODO(ctiller): don't assert
@@ -440,7 +451,8 @@ class ServerAsyncReaderWriter GRPC_FINAL : public ServerAsyncStreamingInterface,
void Finish(const Status& status, void* tag) {
finish_ops_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
- finish_ops_.SendInitialMetadata(ctx_->initial_metadata_);
+ finish_ops_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status);
diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h
index 52b34770a8..55c9788fbd 100644
--- a/include/grpc++/impl/codegen/async_unary_call.h
+++ b/include/grpc++/impl/codegen/async_unary_call.h
@@ -67,7 +67,8 @@ class ClientAsyncResponseReader GRPC_FINAL
call_(channel->CreateCall(method, context, cq)),
collection_(new CallOpSetCollection) {
collection_->init_buf_.SetCollection(collection_);
- collection_->init_buf_.SendInitialMetadata(context->send_initial_metadata_);
+ collection_->init_buf_.SendInitialMetadata(
+ context->send_initial_metadata_, context->initial_metadata_flags());
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(collection_->init_buf_.SendMessage(request).ok());
collection_->init_buf_.ClientSendClose();
@@ -122,7 +123,8 @@ class ServerAsyncResponseWriter GRPC_FINAL
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
meta_buf_.set_output_tag(tag);
- meta_buf_.SendInitialMetadata(ctx_->initial_metadata_);
+ meta_buf_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
call_.PerformOps(&meta_buf_);
}
@@ -130,7 +132,8 @@ class ServerAsyncResponseWriter GRPC_FINAL
void Finish(const W& msg, const Status& status, void* tag) {
finish_buf_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
- finish_buf_.SendInitialMetadata(ctx_->initial_metadata_);
+ finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
// The response is dropped if the status is not OK.
@@ -147,7 +150,8 @@ class ServerAsyncResponseWriter GRPC_FINAL
GPR_CODEGEN_ASSERT(!status.ok());
finish_buf_.set_output_tag(tag);
if (!ctx_->sent_initial_metadata_) {
- finish_buf_.SendInitialMetadata(ctx_->initial_metadata_);
+ finish_buf_.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status);
diff --git a/include/grpc++/impl/codegen/call.h b/include/grpc++/impl/codegen/call.h
index f76d7c23ed..aea1a6acec 100644
--- a/include/grpc++/impl/codegen/call.h
+++ b/include/grpc++/impl/codegen/call.h
@@ -181,8 +181,10 @@ class CallOpSendInitialMetadata {
CallOpSendInitialMetadata() : send_(false) {}
void SendInitialMetadata(
- const std::multimap<grpc::string, grpc::string>& metadata) {
+ const std::multimap<grpc::string, grpc::string>& metadata,
+ uint32_t flags) {
send_ = true;
+ flags_ = flags;
initial_metadata_count_ = metadata.size();
initial_metadata_ = FillMetadataArray(metadata);
}
@@ -192,7 +194,7 @@ class CallOpSendInitialMetadata {
if (!send_) return;
grpc_op* op = &ops[(*nops)++];
op->op = GRPC_OP_SEND_INITIAL_METADATA;
- op->flags = 0;
+ op->flags = flags_;
op->reserved = NULL;
op->data.send_initial_metadata.count = initial_metadata_count_;
op->data.send_initial_metadata.metadata = initial_metadata_;
@@ -204,6 +206,7 @@ class CallOpSendInitialMetadata {
}
bool send_;
+ uint32_t flags_;
size_t initial_metadata_count_;
grpc_metadata* initial_metadata_;
};
diff --git a/include/grpc++/impl/codegen/client_context.h b/include/grpc++/impl/codegen/client_context.h
index 5201808600..aed12767a7 100644
--- a/include/grpc++/impl/codegen/client_context.h
+++ b/include/grpc++/impl/codegen/client_context.h
@@ -221,6 +221,12 @@ class ClientContext {
deadline_ = deadline_tp.raw_time();
}
+ /// EXPERIMENTAL: Set this request to be idempotent
+ void set_idempotent(bool idempotent) { idempotent_ = idempotent; }
+
+ /// EXPERIMENTAL: Trigger fail-fast or not on this request
+ void set_fail_fast(bool fail_fast) { fail_fast_ = fail_fast; }
+
#ifndef GRPC_CXX0X_NO_CHRONO
/// Return the deadline for the client call.
std::chrono::system_clock::time_point deadline() {
@@ -328,9 +334,16 @@ class ClientContext {
grpc_call* call() { return call_; }
void set_call(grpc_call* call, const std::shared_ptr<Channel>& channel);
+ uint32_t initial_metadata_flags() const {
+ return (idempotent_ ? GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST : 0) |
+ (fail_fast_ ? 0 : GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY);
+ }
+
grpc::string authority() { return authority_; }
bool initial_metadata_received_;
+ bool fail_fast_;
+ bool idempotent_;
std::shared_ptr<Channel> channel_;
grpc::mutex mu_;
grpc_call* call_;
diff --git a/include/grpc++/impl/codegen/client_unary_call.h b/include/grpc++/impl/codegen/client_unary_call.h
index 0ee5b198d2..70d65549c8 100644
--- a/include/grpc++/impl/codegen/client_unary_call.h
+++ b/include/grpc++/impl/codegen/client_unary_call.h
@@ -62,7 +62,8 @@ Status BlockingUnaryCall(ChannelInterface* channel, const RpcMethod& method,
if (!status.ok()) {
return status;
}
- ops.SendInitialMetadata(context->send_initial_metadata_);
+ ops.SendInitialMetadata(context->send_initial_metadata_,
+ context->initial_metadata_flags());
ops.RecvInitialMetadata(context);
ops.RecvMessage(result);
ops.ClientSendClose();
diff --git a/include/grpc++/impl/codegen/method_handler_impl.h b/include/grpc++/impl/codegen/method_handler_impl.h
index 436b4d819b..ad74efabc4 100644
--- a/include/grpc++/impl/codegen/method_handler_impl.h
+++ b/include/grpc++/impl/codegen/method_handler_impl.h
@@ -63,7 +63,8 @@ class RpcMethodHandler : public MethodHandler {
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpServerSendStatus>
ops;
- ops.SendInitialMetadata(param.server_context->initial_metadata_);
+ ops.SendInitialMetadata(param.server_context->initial_metadata_,
+ param.server_context->initial_metadata_flags());
if (status.ok()) {
status = ops.SendMessage(rsp);
}
@@ -100,7 +101,8 @@ class ClientStreamingHandler : public MethodHandler {
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpServerSendStatus>
ops;
- ops.SendInitialMetadata(param.server_context->initial_metadata_);
+ ops.SendInitialMetadata(param.server_context->initial_metadata_,
+ param.server_context->initial_metadata_flags());
if (status.ok()) {
status = ops.SendMessage(rsp);
}
@@ -138,7 +140,8 @@ class ServerStreamingHandler : public MethodHandler {
CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> ops;
if (!param.server_context->sent_initial_metadata_) {
- ops.SendInitialMetadata(param.server_context->initial_metadata_);
+ ops.SendInitialMetadata(param.server_context->initial_metadata_,
+ param.server_context->initial_metadata_flags());
}
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
param.call->PerformOps(&ops);
@@ -170,7 +173,8 @@ class BidiStreamingHandler : public MethodHandler {
CallOpSet<CallOpSendInitialMetadata, CallOpServerSendStatus> ops;
if (!param.server_context->sent_initial_metadata_) {
- ops.SendInitialMetadata(param.server_context->initial_metadata_);
+ ops.SendInitialMetadata(param.server_context->initial_metadata_,
+ param.server_context->initial_metadata_flags());
}
ops.ServerSendStatus(param.server_context->trailing_metadata_, status);
param.call->PerformOps(&ops);
@@ -191,7 +195,8 @@ class UnknownMethodHandler : public MethodHandler {
static void FillOps(ServerContext* context, T* ops) {
Status status(StatusCode::UNIMPLEMENTED, "");
if (!context->sent_initial_metadata_) {
- ops->SendInitialMetadata(context->initial_metadata_);
+ ops->SendInitialMetadata(context->initial_metadata_,
+ context->initial_metadata_flags());
context->sent_initial_metadata_ = true;
}
ops->ServerSendStatus(context->trailing_metadata_, status);
diff --git a/include/grpc++/impl/codegen/server_context.h b/include/grpc++/impl/codegen/server_context.h
index 44d340aa45..7fa0235ca9 100644
--- a/include/grpc++/impl/codegen/server_context.h
+++ b/include/grpc++/impl/codegen/server_context.h
@@ -195,6 +195,8 @@ class ServerContext {
void set_call(grpc_call* call);
+ uint32_t initial_metadata_flags() const { return 0; }
+
CompletionOp* completion_op_;
bool has_notify_when_done_tag_;
void* async_notify_when_done_tag_;
diff --git a/include/grpc++/impl/codegen/sync_stream.h b/include/grpc++/impl/codegen/sync_stream.h
index d0ad05169f..9100ce09a2 100644
--- a/include/grpc++/impl/codegen/sync_stream.h
+++ b/include/grpc++/impl/codegen/sync_stream.h
@@ -125,7 +125,8 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
CallOpSet<CallOpSendInitialMetadata, CallOpSendMessage,
CallOpClientSendClose>
ops;
- ops.SendInitialMetadata(context->send_initial_metadata_);
+ ops.SendInitialMetadata(context->send_initial_metadata_,
+ context->initial_metadata_flags());
// TODO(ctiller): don't assert
GPR_CODEGEN_ASSERT(ops.SendMessage(request).ok());
ops.ClientSendClose();
@@ -190,7 +191,8 @@ class ClientWriter : public ClientWriterInterface<W> {
finish_ops_.RecvMessage(response);
CallOpSet<CallOpSendInitialMetadata> ops;
- ops.SendInitialMetadata(context->send_initial_metadata_);
+ ops.SendInitialMetadata(context->send_initial_metadata_,
+ context->initial_metadata_flags());
call_.PerformOps(&ops);
cq_.Pluck(&ops);
}
@@ -268,7 +270,8 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
ClientContext* context)
: context_(context), call_(channel->CreateCall(method, context, &cq_)) {
CallOpSet<CallOpSendInitialMetadata> ops;
- ops.SendInitialMetadata(context->send_initial_metadata_);
+ ops.SendInitialMetadata(context->send_initial_metadata_,
+ context->initial_metadata_flags());
call_.PerformOps(&ops);
cq_.Pluck(&ops);
}
@@ -334,7 +337,8 @@ class ServerReader GRPC_FINAL : public ReaderInterface<R> {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;
- ops.SendInitialMetadata(ctx_->initial_metadata_);
+ ops.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
call_->PerformOps(&ops);
call_->cq()->Pluck(&ops);
@@ -361,7 +365,8 @@ class ServerWriter GRPC_FINAL : public WriterInterface<W> {
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;
- ops.SendInitialMetadata(ctx_->initial_metadata_);
+ ops.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
call_->PerformOps(&ops);
call_->cq()->Pluck(&ops);
@@ -374,7 +379,8 @@ class ServerWriter GRPC_FINAL : public WriterInterface<W> {
return false;
}
if (!ctx_->sent_initial_metadata_) {
- ops.SendInitialMetadata(ctx_->initial_metadata_);
+ ops.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
call_->PerformOps(&ops);
@@ -397,7 +403,8 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
GPR_CODEGEN_ASSERT(!ctx_->sent_initial_metadata_);
CallOpSet<CallOpSendInitialMetadata> ops;
- ops.SendInitialMetadata(ctx_->initial_metadata_);
+ ops.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
call_->PerformOps(&ops);
call_->cq()->Pluck(&ops);
@@ -417,7 +424,8 @@ class ServerReaderWriter GRPC_FINAL : public WriterInterface<W>,
return false;
}
if (!ctx_->sent_initial_metadata_) {
- ops.SendInitialMetadata(ctx_->initial_metadata_);
+ ops.SendInitialMetadata(ctx_->initial_metadata_,
+ ctx_->initial_metadata_flags());
ctx_->sent_initial_metadata_ = true;
}
call_->PerformOps(&ops);
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index 38da99b4d7..4c7373006b 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -142,6 +142,8 @@ typedef struct {
/** Secondary user agent: goes at the end of the user-agent metadata
sent on each request */
#define GRPC_ARG_SECONDARY_USER_AGENT_STRING "grpc.secondary_user_agent"
+/** The maximum time between subsequent connection attempts, in ms */
+#define GRPC_ARG_MAX_RECONNECT_BACKOFF_MS "grpc.max_reconnect_backoff_ms"
/* The caller of the secure_channel_create functions may override the target
name used for SSL host name checking using this channel argument which is of
type GRPC_ARG_STRING. This *should* be used for testing only.
@@ -204,8 +206,12 @@ typedef enum grpc_call_error {
/* Initial metadata flags */
/** Signal that the call is idempotent */
#define GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST (0x00000010u)
+/** Signal that the call should not return UNAVAILABLE before it has started */
+#define GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY (0x00000020u)
/** Mask of all valid flags */
-#define GRPC_INITIAL_METADATA_USED_MASK GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST
+#define GRPC_INITIAL_METADATA_USED_MASK \
+ (GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST | \
+ GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY)
/** A single metadata element */
typedef struct grpc_metadata {
diff --git a/package.json b/package.json
index 24a5aa0cd5..11f703f3f3 100644
--- a/package.json
+++ b/package.json
@@ -106,6 +106,21 @@
"src/core/ext/census/grpc_filter.h",
"src/core/ext/census/mlog.h",
"src/core/ext/census/rpc_metric_id.h",
+ "src/core/ext/client_config/client_channel.h",
+ "src/core/ext/client_config/client_channel_factory.h",
+ "src/core/ext/client_config/client_config.h",
+ "src/core/ext/client_config/connector.h",
+ "src/core/ext/client_config/initial_connect_string.h",
+ "src/core/ext/client_config/lb_policy.h",
+ "src/core/ext/client_config/lb_policy_factory.h",
+ "src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/resolver.h",
+ "src/core/ext/client_config/resolver_factory.h",
+ "src/core/ext/client_config/resolver_registry.h",
+ "src/core/ext/client_config/subchannel.h",
+ "src/core/ext/client_config/subchannel_call_holder.h",
+ "src/core/ext/client_config/subchannel_index.h",
+ "src/core/ext/client_config/uri_parser.h",
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/ext/transport/chttp2/transport/alpn.h",
@@ -132,26 +147,11 @@
"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/client_channel.h",
"src/core/lib/channel/compress_filter.h",
"src/core/lib/channel/connected_channel.h",
"src/core/lib/channel/context.h",
"src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.h",
- "src/core/lib/channel/subchannel_call_holder.h",
- "src/core/lib/client_config/client_config.h",
- "src/core/lib/client_config/connector.h",
- "src/core/lib/client_config/initial_connect_string.h",
- "src/core/lib/client_config/lb_policy.h",
- "src/core/lib/client_config/lb_policy_factory.h",
- "src/core/lib/client_config/lb_policy_registry.h",
- "src/core/lib/client_config/resolver.h",
- "src/core/lib/client_config/resolver_factory.h",
- "src/core/lib/client_config/resolver_registry.h",
- "src/core/lib/client_config/subchannel.h",
- "src/core/lib/client_config/subchannel_factory.h",
- "src/core/lib/client_config/subchannel_index.h",
- "src/core/lib/client_config/uri_parser.h",
"src/core/lib/compression/algorithm_metadata.h",
"src/core/lib/compression/message_compress.h",
"src/core/lib/debug/trace.h",
@@ -244,6 +244,23 @@
"src/core/ext/census/operation.c",
"src/core/ext/census/placeholders.c",
"src/core/ext/census/tracing.c",
+ "src/core/ext/client_config/channel_connectivity.c",
+ "src/core/ext/client_config/client_channel.c",
+ "src/core/ext/client_config/client_channel_factory.c",
+ "src/core/ext/client_config/client_config.c",
+ "src/core/ext/client_config/connector.c",
+ "src/core/ext/client_config/default_initial_connect_string.c",
+ "src/core/ext/client_config/initial_connect_string.c",
+ "src/core/ext/client_config/lb_policy.c",
+ "src/core/ext/client_config/lb_policy_factory.c",
+ "src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/resolver.c",
+ "src/core/ext/client_config/resolver_factory.c",
+ "src/core/ext/client_config/resolver_registry.c",
+ "src/core/ext/client_config/subchannel.c",
+ "src/core/ext/client_config/subchannel_call_holder.c",
+ "src/core/ext/client_config/subchannel_index.c",
+ "src/core/ext/client_config/uri_parser.c",
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c",
"src/core/ext/lb_policy/pick_first/pick_first.c",
@@ -278,26 +295,10 @@
"src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_stack.c",
"src/core/lib/channel/channel_stack_builder.c",
- "src/core/lib/channel/client_channel.c",
"src/core/lib/channel/compress_filter.c",
"src/core/lib/channel/connected_channel.c",
"src/core/lib/channel/http_client_filter.c",
"src/core/lib/channel/http_server_filter.c",
- "src/core/lib/channel/subchannel_call_holder.c",
- "src/core/lib/client_config/client_config.c",
- "src/core/lib/client_config/connector.c",
- "src/core/lib/client_config/default_initial_connect_string.c",
- "src/core/lib/client_config/initial_connect_string.c",
- "src/core/lib/client_config/lb_policy.c",
- "src/core/lib/client_config/lb_policy_factory.c",
- "src/core/lib/client_config/lb_policy_registry.c",
- "src/core/lib/client_config/resolver.c",
- "src/core/lib/client_config/resolver_factory.c",
- "src/core/lib/client_config/resolver_registry.c",
- "src/core/lib/client_config/subchannel.c",
- "src/core/lib/client_config/subchannel_factory.c",
- "src/core/lib/client_config/subchannel_index.c",
- "src/core/lib/client_config/uri_parser.c",
"src/core/lib/compression/compression_algorithm.c",
"src/core/lib/compression/message_compress.c",
"src/core/lib/debug/trace.c",
@@ -370,7 +371,6 @@
"src/core/lib/surface/call_details.c",
"src/core/lib/surface/call_log_batch.c",
"src/core/lib/surface/channel.c",
- "src/core/lib/surface/channel_connectivity.c",
"src/core/lib/surface/channel_init.c",
"src/core/lib/surface/channel_ping.c",
"src/core/lib/surface/channel_stack_type.c",
diff --git a/package.xml b/package.xml
index 0bb34d9487..7730187ba1 100644
--- a/package.xml
+++ b/package.xml
@@ -167,6 +167,21 @@
<file baseinstalldir="/" name="src/core/ext/census/grpc_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/mlog.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/rpc_metric_id.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/client_channel.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/client_channel_factory.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/client_config.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/connector.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/initial_connect_string.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/lb_policy.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/lb_policy_factory.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/lb_policy_registry.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/resolver.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/resolver_factory.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/resolver_registry.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/subchannel.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/subchannel_call_holder.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/subchannel_index.h" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/uri_parser.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/load_balancer_api.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h" role="src" />
<file baseinstalldir="/" name="src/core/ext/transport/chttp2/transport/alpn.h" role="src" />
@@ -193,26 +208,11 @@
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/channel/client_channel.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/compress_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/connected_channel.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/context.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_client_filter.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_server_filter.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/channel/subchannel_call_holder.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/client_config.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/connector.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/initial_connect_string.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/lb_policy.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/lb_policy_factory.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/lb_policy_registry.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/resolver.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/resolver_factory.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/resolver_registry.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/subchannel.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/subchannel_factory.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/subchannel_index.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/uri_parser.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/algorithm_metadata.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/message_compress.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/debug/trace.h" role="src" />
@@ -305,6 +305,23 @@
<file baseinstalldir="/" name="src/core/ext/census/operation.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/placeholders.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/census/tracing.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/channel_connectivity.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/client_channel.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/client_channel_factory.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/client_config.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/connector.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/default_initial_connect_string.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/initial_connect_string.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/lb_policy.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/lb_policy_factory.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/lb_policy_registry.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/resolver.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/resolver_factory.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/resolver_registry.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/subchannel.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/subchannel_call_holder.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/subchannel_index.c" role="src" />
+ <file baseinstalldir="/" name="src/core/ext/client_config/uri_parser.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/load_balancer_api.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c" role="src" />
<file baseinstalldir="/" name="src/core/ext/lb_policy/pick_first/pick_first.c" role="src" />
@@ -339,26 +356,10 @@
<file baseinstalldir="/" name="src/core/lib/channel/channel_args.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/channel_stack_builder.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/channel/client_channel.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/compress_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/connected_channel.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_client_filter.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/channel/http_server_filter.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/channel/subchannel_call_holder.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/client_config.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/connector.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/default_initial_connect_string.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/initial_connect_string.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/lb_policy.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/lb_policy_factory.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/lb_policy_registry.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/resolver.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/resolver_factory.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/resolver_registry.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/subchannel.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/subchannel_factory.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/subchannel_index.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/client_config/uri_parser.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/compression_algorithm.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/compression/message_compress.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/debug/trace.c" role="src" />
@@ -431,7 +432,6 @@
<file baseinstalldir="/" name="src/core/lib/surface/call_details.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call_log_batch.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/channel.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/surface/channel_connectivity.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/channel_init.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/channel_ping.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/channel_stack_type.c" role="src" />
diff --git a/src/compiler/csharp_generator.cc b/src/compiler/csharp_generator.cc
index 5a8746df8d..69e2738d53 100644
--- a/src/compiler/csharp_generator.cc
+++ b/src/compiler/csharp_generator.cc
@@ -81,6 +81,10 @@ std::string GetServerInterfaceName(const ServiceDescriptor* service) {
return "I" + service->name();
}
+std::string GetServerClassName(const ServiceDescriptor* service) {
+ return service->name() + "Base";
+}
+
std::string GetCSharpMethodType(MethodType method_type) {
switch (method_type) {
case METHODTYPE_NO_STREAMING:
@@ -108,10 +112,14 @@ std::string GetMethodFieldName(const MethodDescriptor *method) {
return "__Method_" + method->name();
}
-std::string GetMethodRequestParamMaybe(const MethodDescriptor *method) {
+std::string GetMethodRequestParamMaybe(const MethodDescriptor *method,
+ bool invocation_param=false) {
if (method->client_streaming()) {
return "";
}
+ if (invocation_param) {
+ return "request, ";
+ }
return GetClassName(method->input_type()) + " request, ";
}
@@ -242,6 +250,8 @@ void GenerateServiceDescriptorProperty(Printer* out, const ServiceDescriptor *se
void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
out->Print("// client interface\n");
+ out->Print("[System.Obsolete(\"Client side interfaced will be removed "
+ "in the next release. Use client class directly.\")]\n");
out->Print("public interface $name$\n", "name",
GetClientInterfaceName(service));
out->Print("{\n");
@@ -290,6 +300,8 @@ void GenerateClientInterface(Printer* out, const ServiceDescriptor *service) {
void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) {
out->Print("// server-side interface\n");
+ out->Print("[System.Obsolete(\"Service implementations should inherit"
+ " from the generated abstract base class instead.\")]\n");
out->Print("public interface $name$\n", "name",
GetServerInterfaceName(service));
out->Print("{\n");
@@ -309,21 +321,64 @@ void GenerateServerInterface(Printer* out, const ServiceDescriptor *service) {
out->Print("\n");
}
+void GenerateServerClass(Printer* out, const ServiceDescriptor *service) {
+ out->Print("// server-side abstract class\n");
+ out->Print("public abstract class $name$\n", "name",
+ GetServerClassName(service));
+ out->Print("{\n");
+ out->Indent();
+ for (int i = 0; i < service->method_count(); i++) {
+ const MethodDescriptor *method = service->method(i);
+ out->Print(
+ "public virtual $returntype$ $methodname$($request$$response_stream_maybe$, "
+ "ServerCallContext context)\n",
+ "methodname", method->name(), "returntype",
+ GetMethodReturnTypeServer(method), "request",
+ GetMethodRequestParamServer(method), "response_stream_maybe",
+ GetMethodResponseStreamMaybe(method));
+ out->Print("{\n");
+ out->Indent();
+ out->Print("throw new RpcException("
+ "new Status(StatusCode.Unimplemented, \"\"));\n");
+ out->Outdent();
+ out->Print("}\n\n");
+ }
+ out->Outdent();
+ out->Print("}\n");
+ out->Print("\n");
+}
+
void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
out->Print("// client stub\n");
out->Print(
- "public class $name$ : ClientBase, $interface$\n",
- "name", GetClientClassName(service), "interface",
- GetClientInterfaceName(service));
+ "public class $name$ : ClientBase<$name$>, $interface$\n",
+ "name", GetClientClassName(service),
+ "interface", GetClientInterfaceName(service));
out->Print("{\n");
out->Indent();
// constructors
- out->Print(
- "public $name$(Channel channel) : base(channel)\n",
- "name", GetClientClassName(service));
+ out->Print("public $name$(Channel channel) : base(channel)\n",
+ "name", GetClientClassName(service));
+ out->Print("{\n");
+ out->Print("}\n");
+ out->Print("public $name$(CallInvoker callInvoker) : base(callInvoker)\n",
+ "name", GetClientClassName(service));
out->Print("{\n");
out->Print("}\n");
+ out->Print("///<summary>Protected parameterless constructor to allow creation"
+ " of test doubles.</summary>\n");
+ out->Print("protected $name$() : base()\n",
+ "name", GetClientClassName(service));
+ out->Print("{\n");
+ out->Print("}\n");
+ out->Print("///<summary>Protected constructor to allow creation of configured"
+ " clients.</summary>\n");
+ out->Print("protected $name$(ClientBaseConfiguration configuration)"
+ " : base(configuration)\n",
+ "name", GetClientClassName(service));
+ out->Print("{\n");
+ out->Print("}\n\n");
for (int i = 0; i < service->method_count(); i++) {
const MethodDescriptor *method = service->method(i);
@@ -331,30 +386,26 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
if (method_type == METHODTYPE_NO_STREAMING) {
// unary calls have an extra synchronous stub method
- out->Print(
- "public $response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))\n",
+ out->Print("public virtual $response$ $methodname$($request$ request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))\n",
"methodname", method->name(), "request",
GetClassName(method->input_type()), "response",
GetClassName(method->output_type()));
out->Print("{\n");
out->Indent();
- out->Print("var call = CreateCall($methodfield$, new CallOptions(headers, deadline, cancellationToken));\n",
- "methodfield", GetMethodFieldName(method));
- out->Print("return Calls.BlockingUnaryCall(call, request);\n");
+ out->Print("return $methodname$(request, new CallOptions(headers, deadline, cancellationToken));\n",
+ "methodname", method->name());
out->Outdent();
out->Print("}\n");
// overload taking CallOptions as a param
- out->Print(
- "public $response$ $methodname$($request$ request, CallOptions options)\n",
- "methodname", method->name(), "request",
- GetClassName(method->input_type()), "response",
- GetClassName(method->output_type()));
+ out->Print("public virtual $response$ $methodname$($request$ request, CallOptions options)\n",
+ "methodname", method->name(), "request",
+ GetClassName(method->input_type()), "response",
+ GetClassName(method->output_type()));
out->Print("{\n");
out->Indent();
- out->Print("var call = CreateCall($methodfield$, options);\n",
+ out->Print("return CallInvoker.BlockingUnaryCall($methodfield$, null, options, request);\n",
"methodfield", GetMethodFieldName(method));
- out->Print("return Calls.BlockingUnaryCall(call, request);\n");
out->Outdent();
out->Print("}\n");
}
@@ -364,57 +415,44 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
method_name += "Async"; // prevent name clash with synchronous method.
}
out->Print(
- "public $returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))\n",
- "methodname", method_name, "request_maybe",
- GetMethodRequestParamMaybe(method), "returntype",
- GetMethodReturnTypeClient(method));
+ "public virtual $returntype$ $methodname$($request_maybe$Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))\n",
+ "methodname", method_name, "request_maybe",
+ GetMethodRequestParamMaybe(method), "returntype",
+ GetMethodReturnTypeClient(method));
out->Print("{\n");
out->Indent();
- out->Print("var call = CreateCall($methodfield$, new CallOptions(headers, deadline, cancellationToken));\n",
- "methodfield", GetMethodFieldName(method));
- switch (GetMethodType(method)) {
- case METHODTYPE_NO_STREAMING:
- out->Print("return Calls.AsyncUnaryCall(call, request);\n");
- break;
- case METHODTYPE_CLIENT_STREAMING:
- out->Print("return Calls.AsyncClientStreamingCall(call);\n");
- break;
- case METHODTYPE_SERVER_STREAMING:
- out->Print(
- "return Calls.AsyncServerStreamingCall(call, request);\n");
- break;
- case METHODTYPE_BIDI_STREAMING:
- out->Print("return Calls.AsyncDuplexStreamingCall(call);\n");
- break;
- default:
- GOOGLE_LOG(FATAL)<< "Can't get here.";
- }
+
+ out->Print("return $methodname$($request_maybe$new CallOptions(headers, deadline, cancellationToken));\n",
+ "methodname", method_name,
+ "request_maybe", GetMethodRequestParamMaybe(method, true));
out->Outdent();
out->Print("}\n");
// overload taking CallOptions as a param
out->Print(
- "public $returntype$ $methodname$($request_maybe$CallOptions options)\n",
+ "public virtual $returntype$ $methodname$($request_maybe$CallOptions options)\n",
"methodname", method_name, "request_maybe",
GetMethodRequestParamMaybe(method), "returntype",
GetMethodReturnTypeClient(method));
out->Print("{\n");
out->Indent();
- out->Print("var call = CreateCall($methodfield$, options);\n",
- "methodfield", GetMethodFieldName(method));
switch (GetMethodType(method)) {
case METHODTYPE_NO_STREAMING:
- out->Print("return Calls.AsyncUnaryCall(call, request);\n");
+ out->Print("return CallInvoker.AsyncUnaryCall($methodfield$, null, options, request);\n",
+ "methodfield", GetMethodFieldName(method));
break;
case METHODTYPE_CLIENT_STREAMING:
- out->Print("return Calls.AsyncClientStreamingCall(call);\n");
+ out->Print("return CallInvoker.AsyncClientStreamingCall($methodfield$, null, options);\n",
+ "methodfield", GetMethodFieldName(method));
break;
case METHODTYPE_SERVER_STREAMING:
out->Print(
- "return Calls.AsyncServerStreamingCall(call, request);\n");
+ "return CallInvoker.AsyncServerStreamingCall($methodfield$, null, options, request);\n",
+ "methodfield", GetMethodFieldName(method));
break;
case METHODTYPE_BIDI_STREAMING:
- out->Print("return Calls.AsyncDuplexStreamingCall(call);\n");
+ out->Print("return CallInvoker.AsyncDuplexStreamingCall($methodfield$, null, options);\n",
+ "methodfield", GetMethodFieldName(method));
break;
default:
GOOGLE_LOG(FATAL)<< "Can't get here.";
@@ -422,17 +460,30 @@ void GenerateClientStub(Printer* out, const ServiceDescriptor *service) {
out->Outdent();
out->Print("}\n");
}
+
+ // override NewInstance method
+ out->Print("protected override $name$ NewInstance(ClientBaseConfiguration configuration)\n",
+ "name", GetClientClassName(service));
+ out->Print("{\n");
+ out->Indent();
+ out->Print("return new $name$(configuration);\n",
+ "name", GetClientClassName(service));
+ out->Outdent();
+ out->Print("}\n");
+
out->Outdent();
out->Print("}\n");
out->Print("\n");
}
-void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service) {
+void GenerateBindServiceMethod(Printer* out, const ServiceDescriptor *service,
+ bool use_server_class) {
out->Print(
"// creates service definition that can be registered with a server\n");
out->Print(
"public static ServerServiceDefinition BindService($interface$ serviceImpl)\n",
- "interface", GetServerInterfaceName(service));
+ "interface", use_server_class ? GetServerClassName(service) :
+ GetServerInterfaceName(service));
out->Print("{\n");
out->Indent();
@@ -489,8 +540,10 @@ void GenerateService(Printer* out, const ServiceDescriptor *service) {
GenerateServiceDescriptorProperty(out, service);
GenerateClientInterface(out, service);
GenerateServerInterface(out, service);
+ GenerateServerClass(out, service);
GenerateClientStub(out, service);
- GenerateBindServiceMethod(out, service);
+ GenerateBindServiceMethod(out, service, false);
+ GenerateBindServiceMethod(out, service, true);
GenerateNewStubMethods(out, service);
out->Outdent();
diff --git a/src/core/lib/client_config/README.md b/src/core/ext/client_config/README.md
index fff7a5af5b..7024fd540d 100644
--- a/src/core/lib/client_config/README.md
+++ b/src/core/ext/client_config/README.md
@@ -40,7 +40,7 @@ decisions (for example, by avoiding disconnected backends).
Configured sub-channels are fully setup to participate in the grpc data plane.
Their behavior is specified by a set of grpc channel filters defined at their
construction. To customize this behavior, resolvers build
-grpc_subchannel_factory objects, which use the decorator pattern to customize
+grpc_client_channel_factory objects, which use the decorator pattern to customize
construction arguments for concrete grpc_subchannel instances.
diff --git a/src/core/lib/surface/channel_connectivity.c b/src/core/ext/client_config/channel_connectivity.c
index 9a9ee422c2..3ebc333608 100644
--- a/src/core/lib/surface/channel_connectivity.c
+++ b/src/core/ext/client_config/channel_connectivity.c
@@ -36,7 +36,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/lib/channel/client_channel.h"
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/completion_queue.h"
diff --git a/src/core/lib/channel/client_channel.c b/src/core/ext/client_config/client_channel.c
index 3f7cf1cf97..93d54fdcfe 100644
--- a/src/core/lib/channel/client_channel.c
+++ b/src/core/ext/client_config/client_channel.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/channel/client_channel.h"
+#include "src/core/ext/client_config/client_channel.h"
#include <stdio.h>
#include <string.h>
@@ -41,9 +41,9 @@
#include <grpc/support/sync.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/subchannel_call_holder.h"
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/connected_channel.h"
-#include "src/core/lib/channel/subchannel_call_holder.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/support/string.h"
@@ -114,6 +114,22 @@ static void watch_lb_policy(grpc_exec_ctx *exec_ctx, channel_data *chand,
grpc_lb_policy *lb_policy,
grpc_connectivity_state current_state);
+static void set_channel_connectivity_state_locked(grpc_exec_ctx *exec_ctx,
+ channel_data *chand,
+ grpc_connectivity_state state,
+ const char *reason) {
+ if ((state == GRPC_CHANNEL_TRANSIENT_FAILURE ||
+ state == GRPC_CHANNEL_FATAL_FAILURE) &&
+ chand->lb_policy != NULL) {
+ /* cancel fail-fast picks */
+ grpc_lb_policy_cancel_picks(
+ exec_ctx, chand->lb_policy,
+ /* mask= */ GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY,
+ /* check= */ 0);
+ }
+ grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state, reason);
+}
+
static void on_lb_policy_state_changed_locked(
grpc_exec_ctx *exec_ctx, lb_policy_connectivity_watcher *w) {
grpc_connectivity_state publish_state = w->state;
@@ -127,8 +143,8 @@ static void on_lb_policy_state_changed_locked(
GRPC_LB_POLICY_UNREF(exec_ctx, w->chand->lb_policy, "channel");
w->chand->lb_policy = NULL;
}
- grpc_connectivity_state_set(exec_ctx, &w->chand->state_tracker, publish_state,
- "lb_changed");
+ set_channel_connectivity_state_locked(exec_ctx, w->chand, publish_state,
+ "lb_changed");
if (w->state != GRPC_CHANNEL_FATAL_FAILURE) {
watch_lb_policy(exec_ctx, w->chand, w->lb_policy, w->state);
}
@@ -200,8 +216,8 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
}
if (iomgr_success && chand->resolver) {
- grpc_connectivity_state_set(exec_ctx, &chand->state_tracker, state,
- "new_lb+resolver");
+ set_channel_connectivity_state_locked(exec_ctx, chand, state,
+ "new_lb+resolver");
if (lb_policy != NULL) {
watch_lb_policy(exec_ctx, chand, lb_policy, state);
}
@@ -216,8 +232,8 @@ static void cc_on_config_changed(grpc_exec_ctx *exec_ctx, void *arg,
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
chand->resolver = NULL;
}
- grpc_connectivity_state_set(exec_ctx, &chand->state_tracker,
- GRPC_CHANNEL_FATAL_FAILURE, "resolver_gone");
+ set_channel_connectivity_state_locked(
+ exec_ctx, chand, GRPC_CHANNEL_FATAL_FAILURE, "resolver_gone");
gpr_mu_unlock(&chand->mu_config);
}
@@ -272,8 +288,8 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
}
if (op->disconnect && chand->resolver != NULL) {
- grpc_connectivity_state_set(exec_ctx, &chand->state_tracker,
- GRPC_CHANNEL_FATAL_FAILURE, "disconnect");
+ set_channel_connectivity_state_locked(
+ exec_ctx, chand, GRPC_CHANNEL_FATAL_FAILURE, "disconnect");
grpc_resolver_shutdown(exec_ctx, chand->resolver);
GRPC_RESOLVER_UNREF(exec_ctx, chand->resolver, "channel");
chand->resolver = NULL;
@@ -290,6 +306,7 @@ static void cc_start_transport_op(grpc_exec_ctx *exec_ctx,
typedef struct {
grpc_metadata_batch *initial_metadata;
+ uint32_t initial_metadata_flags;
grpc_connected_subchannel **connected_subchannel;
grpc_closure *on_ready;
grpc_call_element *elem;
@@ -298,6 +315,7 @@ typedef struct {
static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *arg,
grpc_metadata_batch *initial_metadata,
+ uint32_t initial_metadata_flags,
grpc_connected_subchannel **connected_subchannel,
grpc_closure *on_ready);
@@ -308,6 +326,7 @@ static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
} else if (cpa->connected_subchannel == NULL) {
/* cancelled, do nothing */
} else if (cc_pick_subchannel(exec_ctx, cpa->elem, cpa->initial_metadata,
+ cpa->initial_metadata_flags,
cpa->connected_subchannel, cpa->on_ready)) {
grpc_exec_ctx_enqueue(exec_ctx, cpa->on_ready, true, NULL);
}
@@ -316,6 +335,7 @@ static void continue_picking(grpc_exec_ctx *exec_ctx, void *arg, bool success) {
static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
grpc_metadata_batch *initial_metadata,
+ uint32_t initial_metadata_flags,
grpc_connected_subchannel **connected_subchannel,
grpc_closure *on_ready) {
grpc_call_element *elem = elemp;
@@ -349,7 +369,8 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
GRPC_LB_POLICY_REF(lb_policy, "cc_pick_subchannel");
gpr_mu_unlock(&chand->mu_config);
r = grpc_lb_policy_pick(exec_ctx, lb_policy, calld->pollset,
- initial_metadata, connected_subchannel, on_ready);
+ initial_metadata, initial_metadata_flags,
+ connected_subchannel, on_ready);
GRPC_LB_POLICY_UNREF(exec_ctx, lb_policy, "cc_pick_subchannel");
return r;
}
@@ -362,6 +383,7 @@ static int cc_pick_subchannel(grpc_exec_ctx *exec_ctx, void *elemp,
}
cpa = gpr_malloc(sizeof(*cpa));
cpa->initial_metadata = initial_metadata;
+ cpa->initial_metadata_flags = initial_metadata_flags;
cpa->connected_subchannel = connected_subchannel;
cpa->on_ready = on_ready;
cpa->elem = elem;
diff --git a/src/core/lib/channel/client_channel.h b/src/core/ext/client_config/client_channel.h
index ac418c8c51..1e47ad34ad 100644
--- a/src/core/lib/channel/client_channel.h
+++ b/src/core/ext/client_config/client_channel.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_LIB_CHANNEL_CLIENT_CHANNEL_H
-#define GRPC_CORE_LIB_CHANNEL_CLIENT_CHANNEL_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CHANNEL_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CHANNEL_H
+#include "src/core/ext/client_config/resolver.h"
#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/client_config/resolver.h"
/* A client channel is a channel that begins disconnected, and can connect
to some endpoint on demand. If that endpoint disconnects, it will be
@@ -60,4 +60,4 @@ void grpc_client_channel_watch_connectivity_state(
grpc_exec_ctx *exec_ctx, grpc_channel_element *elem, grpc_pollset *pollset,
grpc_connectivity_state *state, grpc_closure *on_complete);
-#endif /* GRPC_CORE_LIB_CHANNEL_CLIENT_CHANNEL_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CHANNEL_H */
diff --git a/src/core/ext/client_config/client_channel_factory.c b/src/core/ext/client_config/client_channel_factory.c
new file mode 100644
index 0000000000..71c64c0da1
--- /dev/null
+++ b/src/core/ext/client_config/client_channel_factory.c
@@ -0,0 +1,57 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "src/core/ext/client_config/client_channel_factory.h"
+
+void grpc_client_channel_factory_ref(grpc_client_channel_factory* factory) {
+ factory->vtable->ref(factory);
+}
+
+void grpc_client_channel_factory_unref(grpc_exec_ctx* exec_ctx,
+ grpc_client_channel_factory* factory) {
+ factory->vtable->unref(exec_ctx, factory);
+}
+
+grpc_subchannel* grpc_client_channel_factory_create_subchannel(
+ grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* factory,
+ grpc_subchannel_args* args) {
+ return factory->vtable->create_subchannel(exec_ctx, factory, args);
+}
+
+grpc_channel* grpc_client_channel_factory_create_channel(
+ grpc_exec_ctx* exec_ctx, grpc_client_channel_factory* factory,
+ const char* target, grpc_client_channel_type type,
+ grpc_channel_args* args) {
+ return factory->vtable->create_client_channel(exec_ctx, factory, target, type,
+ args);
+}
diff --git a/src/core/ext/client_config/client_channel_factory.h b/src/core/ext/client_config/client_channel_factory.h
new file mode 100644
index 0000000000..1241b9b781
--- /dev/null
+++ b/src/core/ext/client_config/client_channel_factory.h
@@ -0,0 +1,85 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CHANNEL_FACTORY_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CHANNEL_FACTORY_H
+
+#include <grpc/impl/codegen/grpc_types.h>
+
+#include "src/core/ext/client_config/subchannel.h"
+#include "src/core/lib/channel/channel_stack.h"
+
+typedef struct grpc_client_channel_factory grpc_client_channel_factory;
+typedef struct grpc_client_channel_factory_vtable
+ grpc_client_channel_factory_vtable;
+
+typedef enum {
+ GRPC_CLIENT_CHANNEL_TYPE_REGULAR, /** for the user-level regular calls */
+ GRPC_CLIENT_CHANNEL_TYPE_LOAD_BALANCING, /** for communication with a load
+ balancing service */
+} grpc_client_channel_type;
+
+/** Constructor for new configured channels.
+ Creating decorators around this type is encouraged to adapt behavior. */
+struct grpc_client_channel_factory {
+ const grpc_client_channel_factory_vtable *vtable;
+};
+
+struct grpc_client_channel_factory_vtable {
+ void (*ref)(grpc_client_channel_factory *factory);
+ void (*unref)(grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *factory);
+ grpc_subchannel *(*create_subchannel)(grpc_exec_ctx *exec_ctx,
+ grpc_client_channel_factory *factory,
+ grpc_subchannel_args *args);
+ grpc_channel *(*create_client_channel)(grpc_exec_ctx *exec_ctx,
+ grpc_client_channel_factory *factory,
+ const char *target,
+ grpc_client_channel_type type,
+ grpc_channel_args *args);
+};
+
+void grpc_client_channel_factory_ref(grpc_client_channel_factory *factory);
+void grpc_client_channel_factory_unref(grpc_exec_ctx *exec_ctx,
+ grpc_client_channel_factory *factory);
+
+/** Create a new grpc_subchannel */
+grpc_subchannel *grpc_client_channel_factory_create_subchannel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *factory,
+ grpc_subchannel_args *args);
+
+/** Create a new grpc_channel */
+grpc_channel *grpc_client_channel_factory_create_channel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *factory,
+ const char *target, grpc_client_channel_type type, grpc_channel_args *args);
+
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CHANNEL_FACTORY_H */
diff --git a/src/core/lib/client_config/client_config.c b/src/core/ext/client_config/client_config.c
index 2521023364..f9b8e68698 100644
--- a/src/core/lib/client_config/client_config.c
+++ b/src/core/ext/client_config/client_config.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/client_config.h"
+#include "src/core/ext/client_config/client_config.h"
#include <string.h>
diff --git a/src/core/lib/client_config/client_config.h b/src/core/ext/client_config/client_config.h
index 8dc2f6b299..a6290cbcf0 100644
--- a/src/core/lib/client_config/client_config.h
+++ b/src/core/ext/client_config/client_config.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_CLIENT_CONFIG_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_CLIENT_CONFIG_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CONFIG_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CONFIG_H
-#include "src/core/lib/client_config/lb_policy.h"
+#include "src/core/ext/client_config/lb_policy.h"
/** Total configuration for a client. Provided, and updated, by
grpc_resolver */
@@ -50,4 +50,4 @@ void grpc_client_config_set_lb_policy(grpc_client_config *client_config,
grpc_lb_policy *grpc_client_config_get_lb_policy(
grpc_client_config *client_config);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_CLIENT_CONFIG_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_CLIENT_CONFIG_H */
diff --git a/src/core/lib/client_config/connector.c b/src/core/ext/client_config/connector.c
index 4c7b823dac..5b629ed5fb 100644
--- a/src/core/lib/client_config/connector.c
+++ b/src/core/ext/client_config/connector.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/connector.h"
+#include "src/core/ext/client_config/connector.h"
grpc_connector* grpc_connector_ref(grpc_connector* connector) {
connector->vtable->ref(connector);
diff --git a/src/core/lib/client_config/connector.h b/src/core/ext/client_config/connector.h
index 39870a261c..dd85dfcb7d 100644
--- a/src/core/lib/client_config/connector.h
+++ b/src/core/ext/client_config/connector.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_CONNECTOR_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_CONNECTOR_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_CONNECTOR_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_CONNECTOR_H
#include "src/core/lib/channel/channel_stack.h"
#include "src/core/lib/iomgr/sockaddr.h"
@@ -89,4 +89,4 @@ void grpc_connector_connect(grpc_exec_ctx *exec_ctx, grpc_connector *connector,
void grpc_connector_shutdown(grpc_exec_ctx *exec_ctx,
grpc_connector *connector);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_CONNECTOR_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_CONNECTOR_H */
diff --git a/src/core/lib/client_config/default_initial_connect_string.c b/src/core/ext/client_config/default_initial_connect_string.c
index a70da4a84a..a70da4a84a 100644
--- a/src/core/lib/client_config/default_initial_connect_string.c
+++ b/src/core/ext/client_config/default_initial_connect_string.c
diff --git a/src/core/lib/client_config/initial_connect_string.c b/src/core/ext/client_config/initial_connect_string.c
index 4034ea2e87..41580d2106 100644
--- a/src/core/lib/client_config/initial_connect_string.c
+++ b/src/core/ext/client_config/initial_connect_string.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/initial_connect_string.h"
+#include "src/core/ext/client_config/initial_connect_string.h"
#include <stddef.h>
diff --git a/src/core/lib/client_config/initial_connect_string.h b/src/core/ext/client_config/initial_connect_string.h
index 51302768c6..06f0767832 100644
--- a/src/core/lib/client_config/initial_connect_string.h
+++ b/src/core/ext/client_config/initial_connect_string.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H
#include <grpc/support/slice.h>
#include "src/core/lib/iomgr/sockaddr.h"
@@ -47,4 +47,4 @@ void grpc_test_set_initial_connect_string_function(
void grpc_set_initial_connect_string(struct sockaddr **addr, size_t *addr_len,
gpr_slice *connect_string);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_INITIAL_CONNECT_STRING_H */
diff --git a/src/core/lib/client_config/lb_policy.c b/src/core/ext/client_config/lb_policy.c
index 3d23669ec2..a7ad9842dc 100644
--- a/src/core/lib/client_config/lb_policy.c
+++ b/src/core/ext/client_config/lb_policy.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/lb_policy.h"
+#include "src/core/ext/client_config/lb_policy.h"
#define WEAK_REF_BITS 16
@@ -101,10 +101,11 @@ void grpc_lb_policy_weak_unref(grpc_exec_ctx *exec_ctx,
int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
grpc_pollset *pollset,
grpc_metadata_batch *initial_metadata,
+ uint32_t initial_metadata_flags,
grpc_connected_subchannel **target,
grpc_closure *on_complete) {
return policy->vtable->pick(exec_ctx, policy, pollset, initial_metadata,
- target, on_complete);
+ initial_metadata_flags, target, on_complete);
}
void grpc_lb_policy_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
@@ -112,6 +113,14 @@ void grpc_lb_policy_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
policy->vtable->cancel_pick(exec_ctx, policy, target);
}
+void grpc_lb_policy_cancel_picks(grpc_exec_ctx *exec_ctx,
+ grpc_lb_policy *policy,
+ uint32_t initial_metadata_flags_mask,
+ uint32_t initial_metadata_flags_eq) {
+ policy->vtable->cancel_picks(exec_ctx, policy, initial_metadata_flags_mask,
+ initial_metadata_flags_eq);
+}
+
void grpc_lb_policy_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy) {
policy->vtable->exit_idle(exec_ctx, policy);
}
diff --git a/src/core/lib/client_config/lb_policy.h b/src/core/ext/client_config/lb_policy.h
index a63e8e68df..0384e0b2eb 100644
--- a/src/core/lib/client_config/lb_policy.h
+++ b/src/core/ext/client_config/lb_policy.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_H
-#include "src/core/lib/client_config/subchannel.h"
+#include "src/core/ext/client_config/subchannel.h"
#include "src/core/lib/transport/connectivity_state.h"
/** A load balancing policy: specified by a vtable and a struct (which
@@ -60,9 +60,13 @@ struct grpc_lb_policy_vtable {
/** implement grpc_lb_policy_pick */
int (*pick)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
grpc_pollset *pollset, grpc_metadata_batch *initial_metadata,
+ uint32_t initial_metadata_flags,
grpc_connected_subchannel **target, grpc_closure *on_complete);
void (*cancel_pick)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
grpc_connected_subchannel **target);
+ void (*cancel_picks)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
+ uint32_t initial_metadata_flags_mask,
+ uint32_t initial_metadata_flags_eq);
void (*ping_one)(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
grpc_closure *closure);
@@ -122,6 +126,7 @@ void grpc_lb_policy_init(grpc_lb_policy *policy,
int grpc_lb_policy_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
grpc_pollset *pollset,
grpc_metadata_batch *initial_metadata,
+ uint32_t initial_metadata_flags,
grpc_connected_subchannel **target,
grpc_closure *on_complete);
@@ -131,6 +136,14 @@ void grpc_lb_policy_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
void grpc_lb_policy_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy,
grpc_connected_subchannel **target);
+/** Cancel all pending picks which have:
+ (initial_metadata_flags & initial_metadata_flags_mask) ==
+ initial_metadata_flags_eq */
+void grpc_lb_policy_cancel_picks(grpc_exec_ctx *exec_ctx,
+ grpc_lb_policy *policy,
+ uint32_t initial_metadata_flags_mask,
+ uint32_t initial_metadata_flags_eq);
+
void grpc_lb_policy_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
@@ -141,4 +154,4 @@ void grpc_lb_policy_notify_on_state_change(grpc_exec_ctx *exec_ctx,
grpc_connectivity_state grpc_lb_policy_check_connectivity(
grpc_exec_ctx *exec_ctx, grpc_lb_policy *policy);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_H */
diff --git a/src/core/lib/client_config/lb_policy_factory.c b/src/core/ext/client_config/lb_policy_factory.c
index 92e1f5f08b..70e46ef3cf 100644
--- a/src/core/lib/client_config/lb_policy_factory.c
+++ b/src/core/ext/client_config/lb_policy_factory.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/lb_policy_factory.h"
+#include "src/core/ext/client_config/lb_policy_factory.h"
void grpc_lb_policy_factory_ref(grpc_lb_policy_factory* factory) {
factory->vtable->ref(factory);
diff --git a/src/core/lib/client_config/lb_policy_factory.h b/src/core/ext/client_config/lb_policy_factory.h
index 6f21912821..1c89b28b59 100644
--- a/src/core/lib/client_config/lb_policy_factory.h
+++ b/src/core/ext/client_config/lb_policy_factory.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_FACTORY_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_FACTORY_H
-#include "src/core/lib/client_config/lb_policy.h"
-#include "src/core/lib/client_config/subchannel_factory.h"
+#include "src/core/ext/client_config/client_channel_factory.h"
+#include "src/core/ext/client_config/lb_policy.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/exec_ctx.h"
@@ -51,7 +51,7 @@ struct grpc_lb_policy_factory {
typedef struct grpc_lb_policy_args {
grpc_resolved_addresses *addresses;
- grpc_subchannel_factory *subchannel_factory;
+ grpc_client_channel_factory *client_channel_factory;
} grpc_lb_policy_args;
struct grpc_lb_policy_factory_vtable {
@@ -75,4 +75,4 @@ grpc_lb_policy *grpc_lb_policy_factory_create_lb_policy(
grpc_exec_ctx *exec_ctx, grpc_lb_policy_factory *factory,
grpc_lb_policy_args *args);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_FACTORY_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_FACTORY_H */
diff --git a/src/core/lib/client_config/lb_policy_registry.c b/src/core/ext/client_config/lb_policy_registry.c
index af396362a1..a23643ecc6 100644
--- a/src/core/lib/client_config/lb_policy_registry.c
+++ b/src/core/ext/client_config/lb_policy_registry.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
#include <string.h>
diff --git a/src/core/lib/client_config/lb_policy_registry.h b/src/core/ext/client_config/lb_policy_registry.h
index 4b8495d8a1..92f38d6de6 100644
--- a/src/core/lib/client_config/lb_policy_registry.h
+++ b/src/core/ext/client_config/lb_policy_registry.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_REGISTRY_H
-#include "src/core/lib/client_config/lb_policy_factory.h"
+#include "src/core/ext/client_config/lb_policy_factory.h"
#include "src/core/lib/iomgr/exec_ctx.h"
/** Initialize the registry and set \a default_factory as the factory to be
@@ -52,4 +52,4 @@ void grpc_register_lb_policy(grpc_lb_policy_factory *factory);
grpc_lb_policy *grpc_lb_policy_create(grpc_exec_ctx *exec_ctx, const char *name,
grpc_lb_policy_args *args);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_LB_POLICY_REGISTRY_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_LB_POLICY_REGISTRY_H */
diff --git a/src/core/lib/client_config/resolver.c b/src/core/ext/client_config/resolver.c
index b9eef5575f..eb004455bd 100644
--- a/src/core/lib/client_config/resolver.c
+++ b/src/core/ext/client_config/resolver.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/resolver.h"
+#include "src/core/ext/client_config/resolver.h"
void grpc_resolver_init(grpc_resolver *resolver,
const grpc_resolver_vtable *vtable) {
diff --git a/src/core/lib/client_config/resolver.h b/src/core/ext/client_config/resolver.h
index cf0bb2bc7a..6ecb5d2774 100644
--- a/src/core/lib/client_config/resolver.h
+++ b/src/core/ext/client_config/resolver.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_H
-#include "src/core/lib/client_config/client_config.h"
-#include "src/core/lib/client_config/subchannel.h"
+#include "src/core/ext/client_config/client_config.h"
+#include "src/core/ext/client_config/subchannel.h"
#include "src/core/lib/iomgr/iomgr.h"
typedef struct grpc_resolver grpc_resolver;
@@ -91,4 +91,4 @@ void grpc_resolver_next(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver,
grpc_client_config **target_config,
grpc_closure *on_complete);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_H */
diff --git a/src/core/lib/client_config/resolver_factory.c b/src/core/ext/client_config/resolver_factory.c
index 001fa28536..67832dcf59 100644
--- a/src/core/lib/client_config/resolver_factory.c
+++ b/src/core/ext/client_config/resolver_factory.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/resolver_factory.h"
+#include "src/core/ext/client_config/resolver_factory.h"
void grpc_resolver_factory_ref(grpc_resolver_factory* factory) {
factory->vtable->ref(factory);
diff --git a/src/core/lib/client_config/resolver_factory.h b/src/core/ext/client_config/resolver_factory.h
index a5bca06475..4eb6979aad 100644
--- a/src/core/lib/client_config/resolver_factory.h
+++ b/src/core/ext/client_config/resolver_factory.h
@@ -31,12 +31,12 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_FACTORY_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_FACTORY_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_FACTORY_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_FACTORY_H
-#include "src/core/lib/client_config/resolver.h"
-#include "src/core/lib/client_config/subchannel_factory.h"
-#include "src/core/lib/client_config/uri_parser.h"
+#include "src/core/ext/client_config/client_channel_factory.h"
+#include "src/core/ext/client_config/resolver.h"
+#include "src/core/ext/client_config/uri_parser.h"
typedef struct grpc_resolver_factory grpc_resolver_factory;
typedef struct grpc_resolver_factory_vtable grpc_resolver_factory_vtable;
@@ -49,7 +49,7 @@ struct grpc_resolver_factory {
typedef struct grpc_resolver_args {
grpc_uri *uri;
- grpc_subchannel_factory *subchannel_factory;
+ grpc_client_channel_factory *client_channel_factory;
} grpc_resolver_args;
struct grpc_resolver_factory_vtable {
@@ -79,4 +79,4 @@ grpc_resolver *grpc_resolver_factory_create_resolver(
char *grpc_resolver_factory_get_default_authority(
grpc_resolver_factory *factory, grpc_uri *uri);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_FACTORY_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_FACTORY_H */
diff --git a/src/core/lib/client_config/resolver_registry.c b/src/core/ext/client_config/resolver_registry.c
index 5f3db273b5..07f29bcb27 100644
--- a/src/core/lib/client_config/resolver_registry.c
+++ b/src/core/ext/client_config/resolver_registry.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include <string.h>
@@ -123,14 +123,14 @@ static grpc_resolver_factory *resolve_factory(const char *target,
}
grpc_resolver *grpc_resolver_create(
- const char *target, grpc_subchannel_factory *subchannel_factory) {
+ const char *target, grpc_client_channel_factory *client_channel_factory) {
grpc_uri *uri = NULL;
grpc_resolver_factory *factory = resolve_factory(target, &uri);
grpc_resolver *resolver;
grpc_resolver_args args;
memset(&args, 0, sizeof(args));
args.uri = uri;
- args.subchannel_factory = subchannel_factory;
+ args.client_channel_factory = client_channel_factory;
resolver = grpc_resolver_factory_create_resolver(factory, &args);
grpc_uri_destroy(uri);
return resolver;
diff --git a/src/core/lib/client_config/resolver_registry.h b/src/core/ext/client_config/resolver_registry.h
index 36c4f2fe03..5ef1383cd3 100644
--- a/src/core/lib/client_config/resolver_registry.h
+++ b/src/core/ext/client_config/resolver_registry.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_REGISTRY_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_REGISTRY_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_REGISTRY_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_REGISTRY_H
-#include "src/core/lib/client_config/resolver_factory.h"
+#include "src/core/ext/client_config/resolver_factory.h"
void grpc_resolver_registry_init(const char *default_prefix);
void grpc_resolver_registry_shutdown(void);
@@ -56,7 +56,7 @@ void grpc_register_resolver_type(grpc_resolver_factory *factory);
return it.
If a resolver factory was not found, return NULL. */
grpc_resolver *grpc_resolver_create(
- const char *target, grpc_subchannel_factory *subchannel_factory);
+ const char *target, grpc_client_channel_factory *client_channel_factory);
/** Find a resolver factory given a name and return an (owned-by-the-caller)
* reference to it */
@@ -66,4 +66,4 @@ grpc_resolver_factory *grpc_resolver_factory_lookup(const char *name);
representing the default authority to pass from a client. */
char *grpc_get_default_authority(const char *target);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_RESOLVER_REGISTRY_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_RESOLVER_REGISTRY_H */
diff --git a/src/core/lib/client_config/subchannel.c b/src/core/ext/client_config/subchannel.c
index 47c53a16ba..20cf245a5b 100644
--- a/src/core/lib/client_config/subchannel.c
+++ b/src/core/ext/client_config/subchannel.c
@@ -31,18 +31,18 @@
*
*/
-#include "src/core/lib/client_config/subchannel.h"
+#include "src/core/ext/client_config/subchannel.h"
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/avl.h>
+#include "src/core/ext/client_config/client_channel.h"
+#include "src/core/ext/client_config/initial_connect_string.h"
+#include "src/core/ext/client_config/subchannel_index.h"
#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/connected_channel.h"
-#include "src/core/lib/client_config/initial_connect_string.h"
-#include "src/core/lib/client_config/subchannel_index.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/support/backoff.h"
@@ -54,7 +54,7 @@
#define STRONG_REF_MASK (~(gpr_atm)((1 << INTERNAL_REF_BITS) - 1))
#define GRPC_SUBCHANNEL_MIN_CONNECT_TIMEOUT_SECONDS 20
-#define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS 1
+#define GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS 2
#define GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER 1.6
#define GRPC_SUBCHANNEL_RECONNECT_MAX_BACKOFF_SECONDS 120
#define GRPC_SUBCHANNEL_RECONNECT_JITTER 0.2
@@ -352,6 +352,25 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
c->args->args[i].value.integer,
c->args->args[i].value.integer);
}
+ if (0 ==
+ strcmp(c->args->args[i].key, GRPC_ARG_MAX_RECONNECT_BACKOFF_MS)) {
+ if (c->args->args[i].type == GRPC_ARG_INTEGER) {
+ if (c->args->args[i].value.integer >= 0) {
+ gpr_backoff_init(
+ &c->backoff_state, GRPC_SUBCHANNEL_RECONNECT_BACKOFF_MULTIPLIER,
+ GRPC_SUBCHANNEL_RECONNECT_JITTER,
+ GPR_MIN(c->args->args[i].value.integer,
+ GRPC_SUBCHANNEL_INITIAL_CONNECT_BACKOFF_SECONDS * 1000),
+ c->args->args[i].value.integer);
+ } else {
+ gpr_log(GPR_ERROR, GRPC_ARG_MAX_RECONNECT_BACKOFF_MS
+ " : must be non-negative");
+ }
+ } else {
+ gpr_log(GPR_ERROR,
+ GRPC_ARG_MAX_RECONNECT_BACKOFF_MS " : must be an integer");
+ }
+ }
}
}
gpr_mu_init(&c->mu);
diff --git a/src/core/lib/client_config/subchannel.h b/src/core/ext/client_config/subchannel.h
index 68aeff39a1..0765a544e8 100644
--- a/src/core/lib/client_config/subchannel.h
+++ b/src/core/ext/client_config/subchannel.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_H
+#include "src/core/ext/client_config/connector.h"
#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/client_config/connector.h"
#include "src/core/lib/transport/connectivity_state.h"
/** A (sub-)channel that knows how to connect to exactly one target
@@ -171,4 +171,4 @@ grpc_subchannel *grpc_subchannel_create(grpc_exec_ctx *exec_ctx,
grpc_connector *connector,
grpc_subchannel_args *args);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_H */
diff --git a/src/core/lib/channel/subchannel_call_holder.c b/src/core/ext/client_config/subchannel_call_holder.c
index 22f3679bf5..3db462b246 100644
--- a/src/core/lib/channel/subchannel_call_holder.c
+++ b/src/core/ext/client_config/subchannel_call_holder.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/channel/subchannel_call_holder.h"
+#include "src/core/ext/client_config/subchannel_call_holder.h"
#include <grpc/support/alloc.h>
@@ -127,7 +127,7 @@ retry:
break;
case GRPC_SUBCHANNEL_CALL_HOLDER_PICKING_SUBCHANNEL:
holder->pick_subchannel(exec_ctx, holder->pick_subchannel_arg, NULL,
- &holder->connected_subchannel, NULL);
+ 0, &holder->connected_subchannel, NULL);
break;
}
gpr_mu_unlock(&holder->mu);
@@ -145,7 +145,8 @@ retry:
GRPC_CALL_STACK_REF(holder->owning_call, "pick_subchannel");
if (holder->pick_subchannel(
exec_ctx, holder->pick_subchannel_arg, op->send_initial_metadata,
- &holder->connected_subchannel, &holder->next_step)) {
+ op->send_initial_metadata_flags, &holder->connected_subchannel,
+ &holder->next_step)) {
holder->creation_phase = GRPC_SUBCHANNEL_CALL_HOLDER_NOT_CREATING;
GRPC_CALL_STACK_UNREF(exec_ctx, holder->owning_call, "pick_subchannel");
}
diff --git a/src/core/lib/channel/subchannel_call_holder.h b/src/core/ext/client_config/subchannel_call_holder.h
index 5cf291a266..9299908788 100644
--- a/src/core/lib/channel/subchannel_call_holder.h
+++ b/src/core/ext/client_config/subchannel_call_holder.h
@@ -31,10 +31,10 @@
*
*/
-#ifndef GRPC_CORE_LIB_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
-#define GRPC_CORE_LIB_CHANNEL_SUBCHANNEL_CALL_HOLDER_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_CALL_HOLDER_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_CALL_HOLDER_H
-#include "src/core/lib/client_config/subchannel.h"
+#include "src/core/ext/client_config/subchannel.h"
/** Pick a subchannel for grpc_subchannel_call_holder;
Return 1 if subchannel is available immediately (in which case on_ready
@@ -42,6 +42,7 @@
called when the subchannel is available) */
typedef int (*grpc_subchannel_call_holder_pick_subchannel)(
grpc_exec_ctx *exec_ctx, void *arg, grpc_metadata_batch *initial_metadata,
+ uint32_t initial_metadata_flags,
grpc_connected_subchannel **connected_subchannel, grpc_closure *on_ready);
typedef enum {
@@ -94,4 +95,4 @@ void grpc_subchannel_call_holder_perform_op(grpc_exec_ctx *exec_ctx,
char *grpc_subchannel_call_holder_get_peer(grpc_exec_ctx *exec_ctx,
grpc_subchannel_call_holder *holder);
-#endif /* GRPC_CORE_LIB_CHANNEL_SUBCHANNEL_CALL_HOLDER_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_CALL_HOLDER_H */
diff --git a/src/core/lib/client_config/subchannel_factory.c b/src/core/ext/client_config/subchannel_factory.c
index 541368ec96..d1e4d75a02 100644
--- a/src/core/lib/client_config/subchannel_factory.c
+++ b/src/core/ext/client_config/subchannel_factory.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/subchannel_factory.h"
+#include "src/core/ext/client_config/subchannel_factory.h"
void grpc_subchannel_factory_ref(grpc_subchannel_factory* factory) {
factory->vtable->ref(factory);
diff --git a/src/core/lib/client_config/subchannel_factory.h b/src/core/ext/client_config/subchannel_factory.h
index 96d68a2079..0fb806d081 100644
--- a/src/core/lib/client_config/subchannel_factory.h
+++ b/src/core/ext/client_config/subchannel_factory.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H
+#include "src/core/ext/client_config/subchannel.h"
#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/client_config/subchannel.h"
typedef struct grpc_subchannel_factory grpc_subchannel_factory;
typedef struct grpc_subchannel_factory_vtable grpc_subchannel_factory_vtable;
@@ -63,4 +63,4 @@ grpc_subchannel *grpc_subchannel_factory_create_subchannel(
grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *factory,
grpc_subchannel_args *args);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_FACTORY_H */
diff --git a/src/core/lib/client_config/subchannel_index.c b/src/core/ext/client_config/subchannel_index.c
index 2c545002a2..ab8d9bd91d 100644
--- a/src/core/lib/client_config/subchannel_index.c
+++ b/src/core/ext/client_config/subchannel_index.c
@@ -31,7 +31,7 @@
//
//
-#include "src/core/lib/client_config/subchannel_index.h"
+#include "src/core/ext/client_config/subchannel_index.h"
#include <stdbool.h>
#include <string.h>
diff --git a/src/core/lib/client_config/subchannel_index.h b/src/core/ext/client_config/subchannel_index.h
index bc5f03beb4..6b8d063855 100644
--- a/src/core/lib/client_config/subchannel_index.h
+++ b/src/core/ext/client_config/subchannel_index.h
@@ -31,11 +31,11 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_INDEX_H
-#include "src/core/lib/client_config/connector.h"
-#include "src/core/lib/client_config/subchannel.h"
+#include "src/core/ext/client_config/connector.h"
+#include "src/core/ext/client_config/subchannel.h"
/** \file Provides an index of active subchannels so that they can be
shared amongst channels */
@@ -74,4 +74,4 @@ void grpc_subchannel_index_init(void);
/** Shutdown the subchannel index (global) */
void grpc_subchannel_index_shutdown(void);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_SUBCHANNEL_INDEX_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_SUBCHANNEL_INDEX_H */
diff --git a/src/core/lib/client_config/uri_parser.c b/src/core/ext/client_config/uri_parser.c
index 6bec70da2d..3ca1a58e69 100644
--- a/src/core/lib/client_config/uri_parser.c
+++ b/src/core/ext/client_config/uri_parser.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/uri_parser.h"
+#include "src/core/ext/client_config/uri_parser.h"
#include <string.h>
diff --git a/src/core/lib/client_config/uri_parser.h b/src/core/ext/client_config/uri_parser.h
index 5d6785d293..875a7cb07c 100644
--- a/src/core/lib/client_config/uri_parser.h
+++ b/src/core/ext/client_config/uri_parser.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_LIB_CLIENT_CONFIG_URI_PARSER_H
-#define GRPC_CORE_LIB_CLIENT_CONFIG_URI_PARSER_H
+#ifndef GRPC_CORE_EXT_CLIENT_CONFIG_URI_PARSER_H
+#define GRPC_CORE_EXT_CLIENT_CONFIG_URI_PARSER_H
#include <stddef.h>
@@ -60,4 +60,4 @@ const char *grpc_uri_get_query_arg(const grpc_uri *uri, const char *key);
/** destroy a uri */
void grpc_uri_destroy(grpc_uri *uri);
-#endif /* GRPC_CORE_LIB_CLIENT_CONFIG_URI_PARSER_H */
+#endif /* GRPC_CORE_EXT_CLIENT_CONFIG_URI_PARSER_H */
diff --git a/src/core/ext/lb_policy/grpclb/load_balancer_api.h b/src/core/ext/lb_policy/grpclb/load_balancer_api.h
index d329a2ffe8..968f7d278a 100644
--- a/src/core/ext/lb_policy/grpclb/load_balancer_api.h
+++ b/src/core/ext/lb_policy/grpclb/load_balancer_api.h
@@ -36,8 +36,8 @@
#include <grpc/support/slice_buffer.h>
+#include "src/core/ext/client_config/lb_policy_factory.h"
#include "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h"
-#include "src/core/lib/client_config/lb_policy_factory.h"
#ifdef __cplusplus
extern "C" {
diff --git a/src/core/ext/lb_policy/pick_first/pick_first.c b/src/core/ext/lb_policy/pick_first/pick_first.c
index cb5c40501e..5926f9d70b 100644
--- a/src/core/ext/lb_policy/pick_first/pick_first.c
+++ b/src/core/ext/lb_policy/pick_first/pick_first.c
@@ -34,12 +34,13 @@
#include <string.h>
#include <grpc/support/alloc.h>
-#include "src/core/lib/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
#include "src/core/lib/transport/connectivity_state.h"
typedef struct pending_pick {
struct pending_pick *next;
grpc_pollset *pollset;
+ uint32_t initial_metadata_flags;
grpc_connected_subchannel **target;
grpc_closure *on_complete;
} pending_pick;
@@ -149,6 +150,31 @@ static void pf_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
gpr_mu_unlock(&p->mu);
}
+static void pf_cancel_picks(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
+ uint32_t initial_metadata_flags_mask,
+ uint32_t initial_metadata_flags_eq) {
+ pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
+ pending_pick *pp;
+ gpr_mu_lock(&p->mu);
+ pp = p->pending_picks;
+ p->pending_picks = NULL;
+ while (pp != NULL) {
+ pending_pick *next = pp->next;
+ if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
+ initial_metadata_flags_eq) {
+ grpc_pollset_set_del_pollset(exec_ctx, p->base.interested_parties,
+ pp->pollset);
+ grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL);
+ gpr_free(pp);
+ } else {
+ pp->next = p->pending_picks;
+ p->pending_picks = pp;
+ }
+ pp = next;
+ }
+ gpr_mu_unlock(&p->mu);
+}
+
static void start_picking(grpc_exec_ctx *exec_ctx, pick_first_lb_policy *p) {
p->started_picking = 1;
p->checking_subchannel = 0;
@@ -171,6 +197,7 @@ static void pf_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
static int pf_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
grpc_pollset *pollset, grpc_metadata_batch *initial_metadata,
+ uint32_t initial_metadata_flags,
grpc_connected_subchannel **target,
grpc_closure *on_complete) {
pick_first_lb_policy *p = (pick_first_lb_policy *)pol;
@@ -199,6 +226,7 @@ static int pf_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
pp->next = p->pending_picks;
pp->pollset = pollset;
pp->target = target;
+ pp->initial_metadata_flags = initial_metadata_flags;
pp->on_complete = on_complete;
p->pending_picks = pp;
gpr_mu_unlock(&p->mu);
@@ -286,11 +314,14 @@ static void pf_connectivity_changed(grpc_exec_ctx *exec_ctx, void *arg,
&p->checking_connectivity, &p->connectivity_changed);
break;
case GRPC_CHANNEL_TRANSIENT_FAILURE:
- grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
- GRPC_CHANNEL_TRANSIENT_FAILURE,
- "connecting_transient_failure");
p->checking_subchannel =
(p->checking_subchannel + 1) % p->num_subchannels;
+ if (p->checking_subchannel == 0) {
+ /* only trigger transient failure when we've tried all alternatives */
+ grpc_connectivity_state_set(exec_ctx, &p->state_tracker,
+ GRPC_CHANNEL_TRANSIENT_FAILURE,
+ "connecting_transient_failure");
+ }
p->checking_connectivity = grpc_subchannel_check_connectivity(
p->subchannels[p->checking_subchannel]);
if (p->checking_connectivity == GRPC_CHANNEL_TRANSIENT_FAILURE) {
@@ -378,14 +409,9 @@ static void pf_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
}
static const grpc_lb_policy_vtable pick_first_lb_policy_vtable = {
- pf_destroy,
- pf_shutdown,
- pf_pick,
- pf_cancel_pick,
- pf_ping_one,
- pf_exit_idle,
- pf_check_connectivity,
- pf_notify_on_state_change};
+ pf_destroy, pf_shutdown, pf_pick,
+ pf_cancel_pick, pf_cancel_picks, pf_ping_one,
+ pf_exit_idle, pf_check_connectivity, pf_notify_on_state_change};
static void pick_first_factory_ref(grpc_lb_policy_factory *factory) {}
@@ -395,7 +421,7 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx,
grpc_lb_policy_factory *factory,
grpc_lb_policy_args *args) {
GPR_ASSERT(args->addresses != NULL);
- GPR_ASSERT(args->subchannel_factory != NULL);
+ GPR_ASSERT(args->client_channel_factory != NULL);
if (args->addresses->naddrs == 0) return NULL;
@@ -412,8 +438,8 @@ static grpc_lb_policy *create_pick_first(grpc_exec_ctx *exec_ctx,
sc_args.addr = (struct sockaddr *)(args->addresses->addrs[i].addr);
sc_args.addr_len = (size_t)args->addresses->addrs[i].len;
- grpc_subchannel *subchannel = grpc_subchannel_factory_create_subchannel(
- exec_ctx, args->subchannel_factory, &sc_args);
+ grpc_subchannel *subchannel = grpc_client_channel_factory_create_subchannel(
+ exec_ctx, args->client_channel_factory, &sc_args);
if (subchannel != NULL) {
p->subchannels[subchannel_idx++] = subchannel;
diff --git a/src/core/ext/lb_policy/round_robin/round_robin.c b/src/core/ext/lb_policy/round_robin/round_robin.c
index d94c081494..3f6051b892 100644
--- a/src/core/ext/lb_policy/round_robin/round_robin.c
+++ b/src/core/ext/lb_policy/round_robin/round_robin.c
@@ -35,7 +35,7 @@
#include <grpc/support/alloc.h>
-#include "src/core/lib/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/transport/connectivity_state.h"
@@ -49,6 +49,7 @@ int grpc_lb_round_robin_trace = 0;
typedef struct pending_pick {
struct pending_pick *next;
grpc_pollset *pollset;
+ uint32_t initial_metadata_flags;
grpc_connected_subchannel **target;
grpc_closure *on_complete;
} pending_pick;
@@ -275,6 +276,32 @@ static void rr_cancel_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
gpr_mu_unlock(&p->mu);
}
+static void rr_cancel_picks(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
+ uint32_t initial_metadata_flags_mask,
+ uint32_t initial_metadata_flags_eq) {
+ round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
+ pending_pick *pp;
+ gpr_mu_lock(&p->mu);
+ pp = p->pending_picks;
+ p->pending_picks = NULL;
+ while (pp != NULL) {
+ pending_pick *next = pp->next;
+ if ((pp->initial_metadata_flags & initial_metadata_flags_mask) ==
+ initial_metadata_flags_eq) {
+ grpc_pollset_set_del_pollset(exec_ctx, p->base.interested_parties,
+ pp->pollset);
+ *pp->target = NULL;
+ grpc_exec_ctx_enqueue(exec_ctx, pp->on_complete, false, NULL);
+ gpr_free(pp);
+ } else {
+ pp->next = p->pending_picks;
+ p->pending_picks = pp;
+ }
+ pp = next;
+ }
+ gpr_mu_unlock(&p->mu);
+}
+
static void start_picking(grpc_exec_ctx *exec_ctx, round_robin_lb_policy *p) {
size_t i;
p->started_picking = 1;
@@ -303,6 +330,7 @@ static void rr_exit_idle(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol) {
static int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
grpc_pollset *pollset, grpc_metadata_batch *initial_metadata,
+ uint32_t initial_metadata_flags,
grpc_connected_subchannel **target,
grpc_closure *on_complete) {
round_robin_lb_policy *p = (round_robin_lb_policy *)pol;
@@ -330,6 +358,7 @@ static int rr_pick(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
pp->pollset = pollset;
pp->target = target;
pp->on_complete = on_complete;
+ pp->initial_metadata_flags = initial_metadata_flags;
p->pending_picks = pp;
gpr_mu_unlock(&p->mu);
return 0;
@@ -485,14 +514,9 @@ static void rr_ping_one(grpc_exec_ctx *exec_ctx, grpc_lb_policy *pol,
}
static const grpc_lb_policy_vtable round_robin_lb_policy_vtable = {
- rr_destroy,
- rr_shutdown,
- rr_pick,
- rr_cancel_pick,
- rr_ping_one,
- rr_exit_idle,
- rr_check_connectivity,
- rr_notify_on_state_change};
+ rr_destroy, rr_shutdown, rr_pick,
+ rr_cancel_pick, rr_cancel_picks, rr_ping_one,
+ rr_exit_idle, rr_check_connectivity, rr_notify_on_state_change};
static void round_robin_factory_ref(grpc_lb_policy_factory *factory) {}
@@ -502,7 +526,7 @@ static grpc_lb_policy *create_round_robin(grpc_exec_ctx *exec_ctx,
grpc_lb_policy_factory *factory,
grpc_lb_policy_args *args) {
GPR_ASSERT(args->addresses != NULL);
- GPR_ASSERT(args->subchannel_factory != NULL);
+ GPR_ASSERT(args->client_channel_factory != NULL);
round_robin_lb_policy *p = gpr_malloc(sizeof(*p));
memset(p, 0, sizeof(*p));
@@ -518,8 +542,8 @@ static grpc_lb_policy *create_round_robin(grpc_exec_ctx *exec_ctx,
sc_args.addr = (struct sockaddr *)(args->addresses->addrs[i].addr);
sc_args.addr_len = (size_t)args->addresses->addrs[i].len;
- grpc_subchannel *subchannel = grpc_subchannel_factory_create_subchannel(
- exec_ctx, args->subchannel_factory, &sc_args);
+ grpc_subchannel *subchannel = grpc_client_channel_factory_create_subchannel(
+ exec_ctx, args->client_channel_factory, &sc_args);
if (subchannel != NULL) {
subchannel_data *sd = gpr_malloc(sizeof(*sd));
diff --git a/src/core/ext/resolver/dns/native/dns_resolver.c b/src/core/ext/resolver/dns/native/dns_resolver.c
index 70d8a3fe2d..2749b0ca01 100644
--- a/src/core/ext/resolver/dns/native/dns_resolver.c
+++ b/src/core/ext/resolver/dns/native/dns_resolver.c
@@ -37,8 +37,8 @@
#include <grpc/support/host_port.h>
#include <grpc/support/string_util.h>
-#include "src/core/lib/client_config/lb_policy_registry.h"
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/support/backoff.h"
@@ -59,7 +59,7 @@ typedef struct {
/** default port to use */
char *default_port;
/** subchannel factory */
- grpc_subchannel_factory *subchannel_factory;
+ grpc_client_channel_factory *client_channel_factory;
/** load balancing policy name */
char *lb_policy_name;
@@ -170,7 +170,7 @@ static void dns_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
config = grpc_client_config_create();
memset(&lb_policy_args, 0, sizeof(lb_policy_args));
lb_policy_args.addresses = addresses;
- lb_policy_args.subchannel_factory = r->subchannel_factory;
+ lb_policy_args.client_channel_factory = r->client_channel_factory;
lb_policy =
grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
if (lb_policy != NULL) {
@@ -228,7 +228,7 @@ static void dns_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
if (r->resolved_config) {
grpc_client_config_unref(exec_ctx, r->resolved_config);
}
- grpc_subchannel_factory_unref(exec_ctx, r->subchannel_factory);
+ grpc_client_channel_factory_unref(exec_ctx, r->client_channel_factory);
gpr_free(r->name);
gpr_free(r->default_port);
gpr_free(r->lb_policy_name);
@@ -255,10 +255,10 @@ static grpc_resolver *dns_create(grpc_resolver_args *args,
grpc_resolver_init(&r->base, &dns_resolver_vtable);
r->name = gpr_strdup(path);
r->default_port = gpr_strdup(default_port);
- r->subchannel_factory = args->subchannel_factory;
+ r->client_channel_factory = args->client_channel_factory;
gpr_backoff_init(&r->backoff_state, BACKOFF_MULTIPLIER, BACKOFF_JITTER,
BACKOFF_MIN_SECONDS * 1000, BACKOFF_MAX_SECONDS * 1000);
- grpc_subchannel_factory_ref(r->subchannel_factory);
+ grpc_client_channel_factory_ref(r->client_channel_factory);
r->lb_policy_name = gpr_strdup(lb_policy_name);
return &r->base;
}
diff --git a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
index 69595ca3db..1f14b40e18 100644
--- a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
+++ b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,17 +31,17 @@
*
*/
-#include <grpc/support/port_platform.h>
-
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
+#include <grpc/support/port_platform.h>
#include <grpc/support/string_util.h>
-#include "src/core/lib/client_config/lb_policy_registry.h"
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
#include "src/core/lib/support/string.h"
@@ -52,7 +52,7 @@ typedef struct {
/** refcount */
gpr_refcount refs;
/** subchannel factory */
- grpc_subchannel_factory *subchannel_factory;
+ grpc_client_channel_factory *client_channel_factory;
/** load balancing policy name */
char *lb_policy_name;
@@ -125,7 +125,7 @@ static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
grpc_lb_policy_args lb_policy_args;
memset(&lb_policy_args, 0, sizeof(lb_policy_args));
lb_policy_args.addresses = r->addresses;
- lb_policy_args.subchannel_factory = r->subchannel_factory;
+ lb_policy_args.client_channel_factory = r->client_channel_factory;
grpc_lb_policy *lb_policy =
grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
grpc_client_config_set_lb_policy(cfg, lb_policy);
@@ -140,7 +140,7 @@ static void sockaddr_maybe_finish_next_locked(grpc_exec_ctx *exec_ctx,
static void sockaddr_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
sockaddr_resolver *r = (sockaddr_resolver *)gr;
gpr_mu_destroy(&r->mu);
- grpc_subchannel_factory_unref(exec_ctx, r->subchannel_factory);
+ grpc_client_channel_factory_unref(exec_ctx, r->client_channel_factory);
grpc_resolved_addresses_destroy(r->addresses);
gpr_free(r->lb_policy_name);
gpr_free(r);
@@ -263,22 +263,24 @@ static grpc_resolver *sockaddr_create(
r = gpr_malloc(sizeof(sockaddr_resolver));
memset(r, 0, sizeof(*r));
- r->lb_policy_name = NULL;
- if (0 != strcmp(args->uri->query, "")) {
- gpr_slice query_slice;
- gpr_slice_buffer query_parts;
-
- query_slice =
- gpr_slice_new(args->uri->query, strlen(args->uri->query), do_nothing);
- gpr_slice_buffer_init(&query_parts);
- gpr_slice_split(query_slice, "=", &query_parts);
- GPR_ASSERT(query_parts.count == 2);
- if (0 == gpr_slice_str_cmp(query_parts.slices[0], "lb_policy")) {
- r->lb_policy_name = gpr_dump_slice(query_parts.slices[1], GPR_DUMP_ASCII);
- }
- gpr_slice_buffer_destroy(&query_parts);
- gpr_slice_unref(query_slice);
+ r->lb_policy_name =
+ gpr_strdup(grpc_uri_get_query_arg(args->uri, "lb_policy"));
+ const char *lb_enabled_qpart =
+ grpc_uri_get_query_arg(args->uri, "lb_enabled");
+ /* anything other than "0" is interpreted as true */
+ const bool lb_enabled =
+ (lb_enabled_qpart != NULL && (strcmp("0", lb_enabled_qpart) != 0));
+
+ if (r->lb_policy_name != NULL && strcmp("grpclb", r->lb_policy_name) == 0 &&
+ !lb_enabled) {
+ /* we want grpclb but the "resolved" addresses aren't LB enabled. Bail
+ * out, as this is meant mostly for tests. */
+ gpr_log(GPR_ERROR,
+ "Requested 'grpclb' LB policy but resolved addresses don't "
+ "support load balancing.");
+ abort();
}
+
if (r->lb_policy_name == NULL) {
r->lb_policy_name = gpr_strdup(default_lb_policy_name);
}
@@ -318,8 +320,8 @@ static grpc_resolver *sockaddr_create(
gpr_ref_init(&r->refs, 1);
gpr_mu_init(&r->mu);
grpc_resolver_init(&r->base, &sockaddr_resolver_vtable);
- r->subchannel_factory = args->subchannel_factory;
- grpc_subchannel_factory_ref(r->subchannel_factory);
+ r->client_channel_factory = args->client_channel_factory;
+ grpc_client_channel_factory_ref(r->client_channel_factory);
return &r->base;
}
diff --git a/src/core/ext/resolver/zookeeper/zookeeper_resolver.c b/src/core/ext/resolver/zookeeper/zookeeper_resolver.c
index 5acb0940c6..898632c3cd 100644
--- a/src/core/ext/resolver/zookeeper/zookeeper_resolver.c
+++ b/src/core/ext/resolver/zookeeper/zookeeper_resolver.c
@@ -39,8 +39,8 @@
#include <grpc/grpc_zookeeper.h>
#include <zookeeper/zookeeper.h>
-#include "src/core/lib/client_config/lb_policy_registry.h"
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/json/json.h"
#include "src/core/lib/support/string.h"
@@ -57,7 +57,7 @@ typedef struct {
/** name to resolve */
char *name;
/** subchannel factory */
- grpc_subchannel_factory *subchannel_factory;
+ grpc_client_channel_factory *client_channel_factory;
/** load balancing policy name */
char *lb_policy_name;
@@ -187,9 +187,8 @@ static void zookeeper_on_resolved(grpc_exec_ctx *exec_ctx, void *arg,
if (addresses != NULL) {
grpc_lb_policy_args lb_policy_args;
config = grpc_client_config_create();
-
lb_policy_args.addresses = addresses;
- lb_policy_args.subchannel_factory = r->subchannel_factory;
+ lb_policy_args.client_channel_factory = r->client_channel_factory;
lb_policy =
grpc_lb_policy_create(exec_ctx, r->lb_policy_name, &lb_policy_args);
@@ -424,7 +423,7 @@ static void zookeeper_destroy(grpc_exec_ctx *exec_ctx, grpc_resolver *gr) {
if (r->resolved_config != NULL) {
grpc_client_config_unref(exec_ctx, r->resolved_config);
}
- grpc_subchannel_factory_unref(exec_ctx, r->subchannel_factory);
+ grpc_client_channel_factory_unref(exec_ctx, r->client_channel_factory);
gpr_free(r->name);
gpr_free(r->lb_policy_name);
gpr_free(r);
@@ -454,8 +453,8 @@ static grpc_resolver *zookeeper_create(grpc_resolver_args *args,
grpc_resolver_init(&r->base, &zookeeper_resolver_vtable);
r->name = gpr_strdup(path);
- r->subchannel_factory = args->subchannel_factory;
- grpc_subchannel_factory_ref(r->subchannel_factory);
+ r->client_channel_factory = args->client_channel_factory;
+ grpc_client_channel_factory_ref(r->client_channel_factory);
r->lb_policy_name = gpr_strdup(lb_policy_name);
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.c b/src/core/ext/transport/chttp2/client/insecure/channel_create.c
index 606fff5fb4..5484438f0a 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.c
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.c
@@ -41,12 +41,12 @@
#include <grpc/support/slice_buffer.h>
#include "src/core/ext/census/grpc_filter.h"
+#include "src/core/ext/client_config/client_channel.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/compress_filter.h"
#include "src/core/lib/channel/http_client_filter.h"
-#include "src/core/lib/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/channel.h"
@@ -136,31 +136,35 @@ static const grpc_connector_vtable connector_vtable = {
connector_ref, connector_unref, connector_shutdown, connector_connect};
typedef struct {
- grpc_subchannel_factory base;
+ grpc_client_channel_factory base;
gpr_refcount refs;
grpc_channel_args *merge_args;
grpc_channel *master;
-} subchannel_factory;
+} client_channel_factory;
-static void subchannel_factory_ref(grpc_subchannel_factory *scf) {
- subchannel_factory *f = (subchannel_factory *)scf;
+static void client_channel_factory_ref(
+ grpc_client_channel_factory *cc_factory) {
+ client_channel_factory *f = (client_channel_factory *)cc_factory;
gpr_ref(&f->refs);
}
-static void subchannel_factory_unref(grpc_exec_ctx *exec_ctx,
- grpc_subchannel_factory *scf) {
- subchannel_factory *f = (subchannel_factory *)scf;
+static void client_channel_factory_unref(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory) {
+ client_channel_factory *f = (client_channel_factory *)cc_factory;
if (gpr_unref(&f->refs)) {
- GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master, "subchannel_factory");
+ if (f->master != NULL) {
+ GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master,
+ "client_channel_factory");
+ }
grpc_channel_args_destroy(f->merge_args);
gpr_free(f);
}
}
-static grpc_subchannel *subchannel_factory_create_subchannel(
- grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *scf,
+static grpc_subchannel *client_channel_factory_create_subchannel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
grpc_subchannel_args *args) {
- subchannel_factory *f = (subchannel_factory *)scf;
+ client_channel_factory *f = (client_channel_factory *)cc_factory;
connector *c = gpr_malloc(sizeof(*c));
grpc_channel_args *final_args =
grpc_channel_args_merge(args->args, f->merge_args);
@@ -175,9 +179,33 @@ static grpc_subchannel *subchannel_factory_create_subchannel(
return s;
}
-static const grpc_subchannel_factory_vtable subchannel_factory_vtable = {
- subchannel_factory_ref, subchannel_factory_unref,
- subchannel_factory_create_subchannel};
+static grpc_channel *client_channel_factory_create_channel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
+ const char *target, grpc_client_channel_type type,
+ grpc_channel_args *args) {
+ client_channel_factory *f = (client_channel_factory *)cc_factory;
+ grpc_channel_args *final_args = grpc_channel_args_merge(args, f->merge_args);
+ grpc_channel *channel = grpc_channel_create(exec_ctx, target, final_args,
+ GRPC_CLIENT_CHANNEL, NULL);
+ grpc_channel_args_destroy(final_args);
+ grpc_resolver *resolver = grpc_resolver_create(target, &f->base);
+ if (!resolver) {
+ GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, channel,
+ "client_channel_factory_create_channel");
+ return NULL;
+ }
+
+ grpc_client_channel_set_resolver(
+ exec_ctx, grpc_channel_get_channel_stack(channel), resolver);
+ GRPC_RESOLVER_UNREF(exec_ctx, resolver, "create_channel");
+
+ return channel;
+}
+
+static const grpc_client_channel_factory_vtable client_channel_factory_vtable =
+ {client_channel_factory_ref, client_channel_factory_unref,
+ client_channel_factory_create_subchannel,
+ client_channel_factory_create_channel};
/* Create a client channel:
Asynchronously: - resolve target
@@ -186,38 +214,27 @@ static const grpc_subchannel_factory_vtable subchannel_factory_vtable = {
grpc_channel *grpc_insecure_channel_create(const char *target,
const grpc_channel_args *args,
void *reserved) {
- grpc_channel *channel = NULL;
- grpc_resolver *resolver;
- subchannel_factory *f;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GRPC_API_TRACE(
"grpc_insecure_channel_create(target=%p, args=%p, reserved=%p)", 3,
(target, args, reserved));
GPR_ASSERT(!reserved);
- channel =
- grpc_channel_create(&exec_ctx, target, args, GRPC_CLIENT_CHANNEL, NULL);
-
- f = gpr_malloc(sizeof(*f));
- f->base.vtable = &subchannel_factory_vtable;
+ client_channel_factory *f = gpr_malloc(sizeof(*f));
+ memset(f, 0, sizeof(*f));
+ f->base.vtable = &client_channel_factory_vtable;
gpr_ref_init(&f->refs, 1);
f->merge_args = grpc_channel_args_copy(args);
- f->master = channel;
- GRPC_CHANNEL_INTERNAL_REF(f->master, "subchannel_factory");
- resolver = grpc_resolver_create(target, &f->base);
- if (!resolver) {
- GRPC_CHANNEL_INTERNAL_UNREF(&exec_ctx, f->master, "subchannel_factory");
- grpc_subchannel_factory_unref(&exec_ctx, &f->base);
- grpc_exec_ctx_finish(&exec_ctx);
- return NULL;
- }
- grpc_client_channel_set_resolver(
- &exec_ctx, grpc_channel_get_channel_stack(channel), resolver);
- GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "create");
- grpc_subchannel_factory_unref(&exec_ctx, &f->base);
+ grpc_channel *channel = client_channel_factory_create_channel(
+ &exec_ctx, &f->base, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, NULL);
+ if (channel != NULL) {
+ f->master = channel;
+ GRPC_CHANNEL_INTERNAL_REF(f->master, "grpc_insecure_channel_create");
+ }
+ grpc_client_channel_factory_unref(&exec_ctx, &f->base);
grpc_exec_ctx_finish(&exec_ctx);
- return channel;
+ return channel; /* may be NULL */
}
diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
index 3465d2b6c4..58af6f995a 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
@@ -40,10 +40,10 @@
#include <grpc/support/slice.h>
#include <grpc/support/slice_buffer.h>
+#include "src/core/ext/client_config/client_channel.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/channel/client_channel.h"
-#include "src/core/lib/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/tcp_client.h"
#include "src/core/lib/security/auth_filters.h"
#include "src/core/lib/security/credentials.h"
@@ -192,34 +192,38 @@ static const grpc_connector_vtable connector_vtable = {
connector_ref, connector_unref, connector_shutdown, connector_connect};
typedef struct {
- grpc_subchannel_factory base;
+ grpc_client_channel_factory base;
gpr_refcount refs;
grpc_channel_args *merge_args;
grpc_channel_security_connector *security_connector;
grpc_channel *master;
-} subchannel_factory;
+} client_channel_factory;
-static void subchannel_factory_ref(grpc_subchannel_factory *scf) {
- subchannel_factory *f = (subchannel_factory *)scf;
+static void client_channel_factory_ref(
+ grpc_client_channel_factory *cc_factory) {
+ client_channel_factory *f = (client_channel_factory *)cc_factory;
gpr_ref(&f->refs);
}
-static void subchannel_factory_unref(grpc_exec_ctx *exec_ctx,
- grpc_subchannel_factory *scf) {
- subchannel_factory *f = (subchannel_factory *)scf;
+static void client_channel_factory_unref(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory) {
+ client_channel_factory *f = (client_channel_factory *)cc_factory;
if (gpr_unref(&f->refs)) {
GRPC_SECURITY_CONNECTOR_UNREF(&f->security_connector->base,
- "subchannel_factory");
- GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master, "subchannel_factory");
+ "client_channel_factory");
+ if (f->master != NULL) {
+ GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, f->master,
+ "client_channel_factory");
+ }
grpc_channel_args_destroy(f->merge_args);
gpr_free(f);
}
}
-static grpc_subchannel *subchannel_factory_create_subchannel(
- grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *scf,
+static grpc_subchannel *client_channel_factory_create_subchannel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
grpc_subchannel_args *args) {
- subchannel_factory *f = (subchannel_factory *)scf;
+ client_channel_factory *f = (client_channel_factory *)cc_factory;
connector *c = gpr_malloc(sizeof(*c));
grpc_channel_args *final_args =
grpc_channel_args_merge(args->args, f->merge_args);
@@ -236,9 +240,37 @@ static grpc_subchannel *subchannel_factory_create_subchannel(
return s;
}
-static const grpc_subchannel_factory_vtable subchannel_factory_vtable = {
- subchannel_factory_ref, subchannel_factory_unref,
- subchannel_factory_create_subchannel};
+static grpc_channel *client_channel_factory_create_channel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
+ const char *target, grpc_client_channel_type type,
+ grpc_channel_args *args) {
+ client_channel_factory *f = (client_channel_factory *)cc_factory;
+
+ grpc_channel_args *final_args = grpc_channel_args_merge(args, f->merge_args);
+ grpc_channel *channel = grpc_channel_create(exec_ctx, target, final_args,
+ GRPC_CLIENT_CHANNEL, NULL);
+ grpc_channel_args_destroy(final_args);
+
+ grpc_resolver *resolver = grpc_resolver_create(target, &f->base);
+ if (resolver != NULL) {
+ grpc_client_channel_set_resolver(
+ exec_ctx, grpc_channel_get_channel_stack(channel), resolver);
+ GRPC_RESOLVER_UNREF(exec_ctx, resolver, "create");
+ } else {
+ GRPC_CHANNEL_INTERNAL_UNREF(exec_ctx, channel,
+ "client_channel_factory_create_channel");
+ channel = NULL;
+ }
+
+ GRPC_SECURITY_CONNECTOR_UNREF(&f->security_connector->base,
+ "client_channel_factory_create_channel");
+ return channel;
+}
+
+static const grpc_client_channel_factory_vtable client_channel_factory_vtable =
+ {client_channel_factory_ref, client_channel_factory_unref,
+ client_channel_factory_create_subchannel,
+ client_channel_factory_create_channel};
/* Create a secure client channel:
Asynchronously: - resolve target
@@ -248,13 +280,11 @@ grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds,
const char *target,
const grpc_channel_args *args,
void *reserved) {
- grpc_channel *channel;
grpc_arg connector_arg;
grpc_channel_args *args_copy;
grpc_channel_args *new_args_from_connector;
grpc_channel_security_connector *security_connector;
- grpc_resolver *resolver;
- subchannel_factory *f;
+ client_channel_factory *f;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GRPC_API_TRACE(
@@ -284,35 +314,30 @@ grpc_channel *grpc_secure_channel_create(grpc_channel_credentials *creds,
new_args_from_connector != NULL ? new_args_from_connector : args,
&connector_arg, 1);
- channel = grpc_channel_create(&exec_ctx, target, args_copy,
- GRPC_CLIENT_CHANNEL, NULL);
-
f = gpr_malloc(sizeof(*f));
- f->base.vtable = &subchannel_factory_vtable;
+ memset(f, 0, sizeof(*f));
+ f->base.vtable = &client_channel_factory_vtable;
gpr_ref_init(&f->refs, 1);
- GRPC_SECURITY_CONNECTOR_REF(&security_connector->base, "subchannel_factory");
- f->security_connector = security_connector;
+
f->merge_args = grpc_channel_args_copy(args_copy);
- f->master = channel;
- GRPC_CHANNEL_INTERNAL_REF(channel, "subchannel_factory");
- resolver = grpc_resolver_create(target, &f->base);
- if (resolver) {
- grpc_client_channel_set_resolver(
- &exec_ctx, grpc_channel_get_channel_stack(channel), resolver);
- GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "create");
- }
- grpc_subchannel_factory_unref(&exec_ctx, &f->base);
- GRPC_SECURITY_CONNECTOR_UNREF(&security_connector->base, "channel_create");
grpc_channel_args_destroy(args_copy);
if (new_args_from_connector != NULL) {
grpc_channel_args_destroy(new_args_from_connector);
}
- if (!resolver) {
- GRPC_CHANNEL_INTERNAL_UNREF(&exec_ctx, channel, "subchannel_factory");
- channel = NULL;
+ GRPC_SECURITY_CONNECTOR_REF(&security_connector->base,
+ "grpc_secure_channel_create");
+ f->security_connector = security_connector;
+
+ grpc_channel *channel = client_channel_factory_create_channel(
+ &exec_ctx, &f->base, target, GRPC_CLIENT_CHANNEL_TYPE_REGULAR, NULL);
+ if (channel != NULL) {
+ f->master = channel;
+ GRPC_CHANNEL_INTERNAL_REF(f->master, "grpc_secure_channel_create");
}
+
+ grpc_client_channel_factory_unref(&exec_ctx, &f->base);
grpc_exec_ctx_finish(&exec_ctx);
- return channel;
+ return channel; /* may be NULL */
}
diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c
index deba23e21f..211f537c69 100644
--- a/src/core/lib/channel/http_client_filter.c
+++ b/src/core/lib/channel/http_client_filter.c
@@ -111,10 +111,12 @@ static void hc_mutate_op(grpc_call_element *elem,
elem);
/* Send : prefixed headers, which have to be before any application
layer headers. */
- grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->method,
- op->send_idempotent_request
- ? GRPC_MDELEM_METHOD_PUT
- : GRPC_MDELEM_METHOD_POST);
+ grpc_metadata_batch_add_head(
+ op->send_initial_metadata, &calld->method,
+ op->send_initial_metadata_flags &
+ GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST
+ ? GRPC_MDELEM_METHOD_PUT
+ : GRPC_MDELEM_METHOD_POST);
grpc_metadata_batch_add_head(op->send_initial_metadata, &calld->scheme,
channeld->static_scheme);
grpc_metadata_batch_add_tail(op->send_initial_metadata, &calld->te_trailers,
diff --git a/src/core/lib/iomgr/ev_poll_and_epoll_posix.c b/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
index dba335490b..3c8127e1a8 100644
--- a/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
+++ b/src/core/lib/iomgr/ev_poll_and_epoll_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/lib/iomgr/ev_posix.c b/src/core/lib/iomgr/ev_posix.c
index 235a7df08d..0eb95a2e09 100644
--- a/src/core/lib/iomgr/ev_posix.c
+++ b/src/core/lib/iomgr/ev_posix.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/lib/iomgr/ev_posix.h b/src/core/lib/iomgr/ev_posix.h
index 9d27b2bcda..1fa9f5ef2d 100644
--- a/src/core/lib/iomgr/ev_posix.h
+++ b/src/core/lib/iomgr/ev_posix.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/src/core/lib/iomgr/unix_sockets_posix.h b/src/core/lib/iomgr/unix_sockets_posix.h
index 752cab85a5..22d6af5044 100644
--- a/src/core/lib/iomgr/unix_sockets_posix.h
+++ b/src/core/lib/iomgr/unix_sockets_posix.h
@@ -38,8 +38,8 @@
#include <grpc/support/string_util.h>
-#include "src/core/lib/client_config/resolver_factory.h"
-#include "src/core/lib/client_config/uri_parser.h"
+#include "src/core/ext/client_config/resolver_factory.h"
+#include "src/core/ext/client_config/uri_parser.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/sockaddr.h"
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index b22bd69f44..6581bbd3d1 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -81,11 +81,11 @@ typedef enum {
/* Status came from the application layer overriding whatever
the wire says */
STATUS_FROM_API_OVERRIDE = 0,
- /* Status was created by some internal channel stack operation */
- STATUS_FROM_CORE,
/* Status came from 'the wire' - or somewhere below the surface
layer */
STATUS_FROM_WIRE,
+ /* Status was created by some internal channel stack operation */
+ STATUS_FROM_CORE,
/* Status came from the server sending status */
STATUS_FROM_SERVER_STATUS,
STATUS_SOURCE_COUNT
@@ -1115,6 +1115,9 @@ static void finish_batch(grpc_exec_ctx *exec_ctx, void *bctlp, bool success) {
gpr_mu_lock(&call->mu);
if (bctl->send_initial_metadata) {
+ if (!success) {
+ set_status_code(call, STATUS_FROM_CORE, GRPC_STATUS_UNAVAILABLE);
+ }
grpc_metadata_batch_destroy(
&call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */]);
}
@@ -1237,8 +1240,7 @@ static grpc_call_error call_start_batch(grpc_exec_ctx *exec_ctx,
call->metadata_batch[0][0].deadline = call->send_deadline;
stream_op.send_initial_metadata =
&call->metadata_batch[0 /* is_receiving */][0 /* is_trailing */];
- stream_op.send_idempotent_request =
- (op->flags & GRPC_INITIAL_METADATA_IDEMPOTENT_REQUEST) != 0;
+ stream_op.send_initial_metadata_flags = op->flags;
break;
case GRPC_OP_SEND_MESSAGE:
if (!are_write_flags_valid(op->flags)) {
diff --git a/src/core/lib/surface/channel.c b/src/core/lib/surface/channel.c
index 06f991b085..332f504507 100644
--- a/src/core/lib/surface/channel.c
+++ b/src/core/lib/surface/channel.c
@@ -40,7 +40,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/iomgr.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/surface/api_trace.h"
diff --git a/src/core/lib/surface/channel.h b/src/core/lib/surface/channel.h
index 640fd7e137..22dae930e4 100644
--- a/src/core/lib/surface/channel.h
+++ b/src/core/lib/surface/channel.h
@@ -35,7 +35,6 @@
#define GRPC_CORE_LIB_SURFACE_CHANNEL_H
#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/client_config/subchannel_factory.h"
#include "src/core/lib/surface/channel_stack_type.h"
grpc_channel *grpc_channel_create(grpc_exec_ctx *exec_ctx, const char *target,
diff --git a/src/core/lib/surface/init.c b/src/core/lib/surface/init.c
index aca4ce9d07..f221d8db35 100644
--- a/src/core/lib/surface/init.c
+++ b/src/core/lib/surface/init.c
@@ -39,17 +39,17 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/time.h>
+#include "src/core/ext/client_config/client_channel.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/subchannel.h"
+#include "src/core/ext/client_config/subchannel_index.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/compress_filter.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_client_filter.h"
#include "src/core/lib/channel/http_server_filter.h"
-#include "src/core/lib/client_config/lb_policy_registry.h"
-#include "src/core/lib/client_config/resolver_registry.h"
-#include "src/core/lib/client_config/subchannel.h"
-#include "src/core/lib/client_config/subchannel_index.h"
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/executor.h"
#include "src/core/lib/iomgr/iomgr.h"
diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h
index a78d71322c..1eb446312b 100644
--- a/src/core/lib/transport/transport.h
+++ b/src/core/lib/transport/transport.h
@@ -101,9 +101,9 @@ typedef struct grpc_transport_stream_op {
/** Send initial metadata to the peer, from the provided metadata batch.
idempotent_request MUST be set if this is non-null */
grpc_metadata_batch *send_initial_metadata;
- /** Iff send_initial_metadata != NULL, flags if this is an idempotent request
- or not */
- bool send_idempotent_request;
+ /** Iff send_initial_metadata != NULL, flags associated with
+ send_initial_metadata: a bitfield of GRPC_INITIAL_METADATA_xxx */
+ uint32_t send_initial_metadata_flags;
/** Send trailing metadata to the peer, from the provided metadata batch. */
grpc_metadata_batch *send_trailing_metadata;
diff --git a/src/cpp/client/client_context.cc b/src/cpp/client/client_context.cc
index bf6423128a..c277d7ebe8 100644
--- a/src/cpp/client/client_context.cc
+++ b/src/cpp/client/client_context.cc
@@ -60,6 +60,8 @@ static ClientContext::GlobalCallbacks* g_client_callbacks =
ClientContext::ClientContext()
: initial_metadata_received_(false),
+ fail_fast_(true),
+ idempotent_(false),
call_(nullptr),
call_canceled_(false),
deadline_(gpr_inf_future(GPR_CLOCK_REALTIME)),
diff --git a/src/csharp/Grpc.Core/CallInvoker.cs b/src/csharp/Grpc.Core/CallInvoker.cs
new file mode 100644
index 0000000000..39199b1fd5
--- /dev/null
+++ b/src/csharp/Grpc.Core/CallInvoker.cs
@@ -0,0 +1,84 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System.Threading.Tasks;
+using Grpc.Core.Internal;
+
+namespace Grpc.Core
+{
+ /// <summary>
+ /// Abstraction of client-side RPC invocation.
+ /// </summary>
+ /// <seealso cref="Calls"/>
+ public abstract class CallInvoker
+ {
+ /// <summary>
+ /// Invokes a simple remote call in a blocking fashion.
+ /// </summary>
+ public abstract TResponse BlockingUnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ where TRequest : class
+ where TResponse : class;
+
+ /// <summary>
+ /// Invokes a simple remote call asynchronously.
+ /// </summary>
+ public abstract AsyncUnaryCall<TResponse> AsyncUnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ where TRequest : class
+ where TResponse : class;
+
+ /// <summary>
+ /// Invokes a server streaming call asynchronously.
+ /// In server streaming scenario, client sends on request and server responds with a stream of responses.
+ /// </summary>
+ public abstract AsyncServerStreamingCall<TResponse> AsyncServerStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ where TRequest : class
+ where TResponse : class;
+
+ /// <summary>
+ /// Invokes a client streaming call asynchronously.
+ /// In client streaming scenario, client sends a stream of requests and server responds with a single response.
+ /// </summary>
+ public abstract AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ where TRequest : class
+ where TResponse : class;
+
+ /// <summary>
+ /// Invokes a duplex streaming call asynchronously.
+ /// In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses.
+ /// The response stream is completely independent and both side can be sending messages at the same time.
+ /// </summary>
+ public abstract AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ where TRequest : class
+ where TResponse : class;
+ }
+}
diff --git a/src/csharp/Grpc.Core/ClientBase.cs b/src/csharp/Grpc.Core/ClientBase.cs
index e5b398062b..5517233e3c 100644
--- a/src/csharp/Grpc.Core/ClientBase.cs
+++ b/src/csharp/Grpc.Core/ClientBase.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -31,93 +31,156 @@
#endregion
-using System;
-using System.Text.RegularExpressions;
-using System.Threading.Tasks;
+using Grpc.Core.Internal;
+using Grpc.Core.Utils;
namespace Grpc.Core
{
/// <summary>
- /// Interceptor for call headers.
+ /// Generic base class for client-side stubs.
/// </summary>
- /// <remarks>Header interceptor is no longer to recommented way to perform authentication.
- /// For header (initial metadata) based auth such as OAuth2 or JWT access token, use <see cref="MetadataCredentials"/>.
- /// </remarks>
- public delegate void HeaderInterceptor(IMethod method, Metadata metadata);
+ public abstract class ClientBase<T> : ClientBase
+ where T : ClientBase<T>
+ {
+ /// <summary>
+ /// Initializes a new instance of <c>ClientBase</c> class that
+ /// throws <c>NotImplementedException</c> upon invocation of any RPC.
+ /// This constructor is only provided to allow creation of test doubles
+ /// for client classes (e.g. mocking requires a parameterless constructor).
+ /// </summary>
+ protected ClientBase() : base()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of <c>ClientBase</c> class.
+ /// </summary>
+ /// <param name="configuration">The configuration.</param>
+ protected ClientBase(ClientBaseConfiguration configuration) : base(configuration)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of <c>ClientBase</c> class.
+ /// </summary>
+ /// <param name="channel">The channel to use for remote call invocation.</param>
+ public ClientBase(Channel channel) : base(channel)
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of <c>ClientBase</c> class.
+ /// </summary>
+ /// <param name="callInvoker">The <c>CallInvoker</c> for remote call invocation.</param>
+ public ClientBase(CallInvoker callInvoker) : base(callInvoker)
+ {
+ }
+
+ /// <summary>
+ /// Creates a new client that sets host field for calls explicitly.
+ /// gRPC supports multiple "hosts" being served by a single server.
+ /// By default (if a client was not created by calling this method),
+ /// host <c>null</c> with the meaning "use default host" is used.
+ /// </summary>
+ public T WithHost(string host)
+ {
+ var newConfiguration = this.Configuration.WithHost(host);
+ return NewInstance(newConfiguration);
+ }
+
+ /// <summary>
+ /// Creates a new instance of client from given <c>ClientBaseConfiguration</c>.
+ /// </summary>
+ protected abstract T NewInstance(ClientBaseConfiguration configuration);
+ }
/// <summary>
/// Base class for client-side stubs.
/// </summary>
public abstract class ClientBase
{
- readonly Channel channel;
+ readonly ClientBaseConfiguration configuration;
+ readonly CallInvoker callInvoker;
+
+ /// <summary>
+ /// Initializes a new instance of <c>ClientBase</c> class that
+ /// throws <c>NotImplementedException</c> upon invocation of any RPC.
+ /// This constructor is only provided to allow creation of test doubles
+ /// for client classes (e.g. mocking requires a parameterless constructor).
+ /// </summary>
+ protected ClientBase() : this(new UnimplementedCallInvoker())
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of <c>ClientBase</c> class.
+ /// </summary>
+ /// <param name="configuration">The configuration.</param>
+ protected ClientBase(ClientBaseConfiguration configuration)
+ {
+ this.configuration = GrpcPreconditions.CheckNotNull(configuration, "configuration");
+ this.callInvoker = configuration.CreateDecoratedCallInvoker();
+ }
/// <summary>
/// Initializes a new instance of <c>ClientBase</c> class.
/// </summary>
/// <param name="channel">The channel to use for remote call invocation.</param>
- public ClientBase(Channel channel)
+ public ClientBase(Channel channel) : this(new DefaultCallInvoker(channel))
{
- this.channel = channel;
}
/// <summary>
- /// Can be used to register a custom header interceptor.
- /// The interceptor is invoked each time a new call on this client is started.
- /// It is not recommented to use header interceptor to add auth headers to RPC calls.
+ /// Initializes a new instance of <c>ClientBase</c> class.
/// </summary>
- /// <seealso cref="HeaderInterceptor"/>
- public HeaderInterceptor HeaderInterceptor
+ /// <param name="callInvoker">The <c>CallInvoker</c> for remote call invocation.</param>
+ public ClientBase(CallInvoker callInvoker) : this(new ClientBaseConfiguration(callInvoker, null))
{
- get;
- set;
}
/// <summary>
- /// gRPC supports multiple "hosts" being served by a single server.
- /// This property can be used to set the target host explicitly.
- /// By default, this will be set to <c>null</c> with the meaning
- /// "use default host".
+ /// Gets the call invoker.
/// </summary>
- public string Host
+ protected CallInvoker CallInvoker
{
- get;
- set;
+ get { return this.callInvoker; }
}
/// <summary>
- /// Channel associated with this client.
+ /// Gets the configuration.
/// </summary>
- public Channel Channel
+ internal ClientBaseConfiguration Configuration
{
- get
- {
- return this.channel;
- }
+ get { return this.configuration; }
}
/// <summary>
- /// Creates a new call to given method.
+ /// Represents configuration of ClientBase. The class itself is visible to
+ /// subclasses, but contents are marked as internal to make the instances opaque.
+ /// The verbose name of this class was chosen to make name clash in generated code
+ /// less likely.
/// </summary>
- /// <param name="method">The method to invoke.</param>
- /// <param name="options">The call options.</param>
- /// <typeparam name="TRequest">Request message type.</typeparam>
- /// <typeparam name="TResponse">Response message type.</typeparam>
- /// <returns>The call invocation details.</returns>
- protected CallInvocationDetails<TRequest, TResponse> CreateCall<TRequest, TResponse>(Method<TRequest, TResponse> method, CallOptions options)
- where TRequest : class
- where TResponse : class
+ protected internal class ClientBaseConfiguration
{
- var interceptor = HeaderInterceptor;
- if (interceptor != null)
+ readonly CallInvoker undecoratedCallInvoker;
+ readonly string host;
+
+ internal ClientBaseConfiguration(CallInvoker undecoratedCallInvoker, string host)
+ {
+ this.undecoratedCallInvoker = GrpcPreconditions.CheckNotNull(undecoratedCallInvoker);
+ this.host = host;
+ }
+
+ internal CallInvoker CreateDecoratedCallInvoker()
+ {
+ return new InterceptingCallInvoker(undecoratedCallInvoker, hostInterceptor: (h) => host);
+ }
+
+ internal ClientBaseConfiguration WithHost(string host)
{
- if (options.Headers == null)
- {
- options = options.WithHeaders(new Metadata());
- }
- interceptor(method, options.Headers);
+ GrpcPreconditions.CheckNotNull(host, "host");
+ return new ClientBaseConfiguration(this.undecoratedCallInvoker, host);
}
- return new CallInvocationDetails<TRequest, TResponse>(channel, method, Host, options);
}
}
}
diff --git a/src/csharp/Grpc.Core/DefaultCallInvoker.cs b/src/csharp/Grpc.Core/DefaultCallInvoker.cs
new file mode 100644
index 0000000000..1a99e41153
--- /dev/null
+++ b/src/csharp/Grpc.Core/DefaultCallInvoker.cs
@@ -0,0 +1,112 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System.Threading.Tasks;
+using Grpc.Core.Internal;
+using Grpc.Core.Utils;
+
+namespace Grpc.Core
+{
+ /// <summary>
+ /// Invokes client RPCs using <see cref="Calls"/>.
+ /// </summary>
+ public class DefaultCallInvoker : CallInvoker
+ {
+ readonly Channel channel;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Grpc.Core.DefaultCallInvoker"/> class.
+ /// </summary>
+ /// <param name="channel">Channel to use.</param>
+ public DefaultCallInvoker(Channel channel)
+ {
+ this.channel = GrpcPreconditions.CheckNotNull(channel);
+ }
+
+ /// <summary>
+ /// Invokes a simple remote call in a blocking fashion.
+ /// </summary>
+ public override TResponse BlockingUnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ var call = CreateCall(method, host, options);
+ return Calls.BlockingUnaryCall(call, request);
+ }
+
+ /// <summary>
+ /// Invokes a simple remote call asynchronously.
+ /// </summary>
+ public override AsyncUnaryCall<TResponse> AsyncUnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ var call = CreateCall(method, host, options);
+ return Calls.AsyncUnaryCall(call, request);
+ }
+
+ /// <summary>
+ /// Invokes a server streaming call asynchronously.
+ /// In server streaming scenario, client sends on request and server responds with a stream of responses.
+ /// </summary>
+ public override AsyncServerStreamingCall<TResponse> AsyncServerStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ var call = CreateCall(method, host, options);
+ return Calls.AsyncServerStreamingCall(call, request);
+ }
+
+ /// <summary>
+ /// Invokes a client streaming call asynchronously.
+ /// In client streaming scenario, client sends a stream of requests and server responds with a single response.
+ /// </summary>
+ public override AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ {
+ var call = CreateCall(method, host, options);
+ return Calls.AsyncClientStreamingCall(call);
+ }
+
+ /// <summary>
+ /// Invokes a duplex streaming call asynchronously.
+ /// In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses.
+ /// The response stream is completely independent and both side can be sending messages at the same time.
+ /// </summary>
+ public override AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ {
+ var call = CreateCall(method, host, options);
+ return Calls.AsyncDuplexStreamingCall(call);
+ }
+
+ protected virtual CallInvocationDetails<TRequest, TResponse> CreateCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ where TRequest : class
+ where TResponse : class
+ {
+ return new CallInvocationDetails<TRequest, TResponse>(channel, method, host, options);
+ }
+ }
+}
diff --git a/src/csharp/Grpc.Core/Grpc.Core.csproj b/src/csharp/Grpc.Core/Grpc.Core.csproj
index 3189835ccd..251a688946 100644
--- a/src/csharp/Grpc.Core/Grpc.Core.csproj
+++ b/src/csharp/Grpc.Core/Grpc.Core.csproj
@@ -129,6 +129,10 @@
<Compile Include="Profiling\Profilers.cs" />
<Compile Include="Internal\DefaultSslRootsOverride.cs" />
<Compile Include="Utils\GrpcPreconditions.cs" />
+ <Compile Include="CallInvoker.cs" />
+ <Compile Include="DefaultCallInvoker.cs" />
+ <Compile Include="Internal\UnimplementedCallInvoker.cs" />
+ <Compile Include="Internal\InterceptingCallInvoker.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Grpc.Core.nuspec" />
diff --git a/src/csharp/Grpc.Core/Internal/InterceptingCallInvoker.cs b/src/csharp/Grpc.Core/Internal/InterceptingCallInvoker.cs
new file mode 100644
index 0000000000..ef48dc7121
--- /dev/null
+++ b/src/csharp/Grpc.Core/Internal/InterceptingCallInvoker.cs
@@ -0,0 +1,134 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Threading.Tasks;
+using Grpc.Core;
+using Grpc.Core.Utils;
+
+namespace Grpc.Core.Internal
+{
+ /// <summary>
+ /// Decorates an underlying <c>CallInvoker</c> to intercept call invocations.
+ /// </summary>
+ internal class InterceptingCallInvoker : CallInvoker
+ {
+ readonly CallInvoker callInvoker;
+ readonly Func<string, string> hostInterceptor;
+ readonly Func<CallOptions, CallOptions> callOptionsInterceptor;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="Grpc.Core.InterceptingCallInvoker"/> class.
+ /// </summary>
+ public InterceptingCallInvoker(CallInvoker callInvoker,
+ Func<string, string> hostInterceptor = null,
+ Func<CallOptions, CallOptions> callOptionsInterceptor = null)
+ {
+ this.callInvoker = GrpcPreconditions.CheckNotNull(callInvoker);
+ this.hostInterceptor = hostInterceptor;
+ this.callOptionsInterceptor = callOptionsInterceptor;
+ }
+
+ /// <summary>
+ /// Intercepts a unary call.
+ /// </summary>
+ public override TResponse BlockingUnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ host = InterceptHost(host);
+ options = InterceptCallOptions(options);
+ return callInvoker.BlockingUnaryCall(method, host, options, request);
+ }
+
+ /// <summary>
+ /// Invokes a simple remote call asynchronously.
+ /// </summary>
+ public override AsyncUnaryCall<TResponse> AsyncUnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ host = InterceptHost(host);
+ options = InterceptCallOptions(options);
+ return callInvoker.AsyncUnaryCall(method, host, options, request);
+ }
+
+ /// <summary>
+ /// Invokes a server streaming call asynchronously.
+ /// In server streaming scenario, client sends on request and server responds with a stream of responses.
+ /// </summary>
+ public override AsyncServerStreamingCall<TResponse> AsyncServerStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ host = InterceptHost(host);
+ options = InterceptCallOptions(options);
+ return callInvoker.AsyncServerStreamingCall(method, host, options, request);
+ }
+
+ /// <summary>
+ /// Invokes a client streaming call asynchronously.
+ /// In client streaming scenario, client sends a stream of requests and server responds with a single response.
+ /// </summary>
+ public override AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ {
+ host = InterceptHost(host);
+ options = InterceptCallOptions(options);
+ return callInvoker.AsyncClientStreamingCall(method, host, options);
+ }
+
+ /// <summary>
+ /// Invokes a duplex streaming call asynchronously.
+ /// In duplex streaming scenario, client sends a stream of requests and server responds with a stream of responses.
+ /// The response stream is completely independent and both side can be sending messages at the same time.
+ /// </summary>
+ public override AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ {
+ host = InterceptHost(host);
+ options = InterceptCallOptions(options);
+ return callInvoker.AsyncDuplexStreamingCall(method, host, options);
+ }
+
+ private string InterceptHost(string host)
+ {
+ if (hostInterceptor == null)
+ {
+ return host;
+ }
+ return hostInterceptor(host);
+ }
+
+ private CallOptions InterceptCallOptions(CallOptions options)
+ {
+ if (callOptionsInterceptor == null)
+ {
+ return options;
+ }
+ return callOptionsInterceptor(options);
+ }
+ }
+}
diff --git a/src/csharp/Grpc.Core/Internal/UnimplementedCallInvoker.cs b/src/csharp/Grpc.Core/Internal/UnimplementedCallInvoker.cs
new file mode 100644
index 0000000000..0c7340873b
--- /dev/null
+++ b/src/csharp/Grpc.Core/Internal/UnimplementedCallInvoker.cs
@@ -0,0 +1,75 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Threading.Tasks;
+using Grpc.Core;
+using Grpc.Core.Utils;
+
+namespace Grpc.Core.Internal
+{
+ /// <summary>
+ /// Call invoker that throws <c>NotImplementedException</c> for all requests.
+ /// </summary>
+ internal class UnimplementedCallInvoker : CallInvoker
+ {
+ public UnimplementedCallInvoker()
+ {
+ }
+
+ public override TResponse BlockingUnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override AsyncUnaryCall<TResponse> AsyncUnaryCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override AsyncServerStreamingCall<TResponse> AsyncServerStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options, TRequest request)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override AsyncClientStreamingCall<TRequest, TResponse> AsyncClientStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ {
+ throw new NotImplementedException();
+ }
+
+ public override AsyncDuplexStreamingCall<TRequest, TResponse> AsyncDuplexStreamingCall<TRequest, TResponse>(Method<TRequest, TResponse> method, string host, CallOptions options)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/src/csharp/Grpc.Examples.MathClient/MathClient.cs b/src/csharp/Grpc.Examples.MathClient/MathClient.cs
index 64e429ed5a..aadef6833d 100644
--- a/src/csharp/Grpc.Examples.MathClient/MathClient.cs
+++ b/src/csharp/Grpc.Examples.MathClient/MathClient.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -40,7 +40,7 @@ namespace Math
public static void Main(string[] args)
{
var channel = new Channel("127.0.0.1", 23456, ChannelCredentials.Insecure);
- Math.IMathClient client = new Math.MathClient(channel);
+ Math.MathClient client = new Math.MathClient(channel);
MathExamples.DivExample(client);
MathExamples.DivAsyncExample(client).Wait();
diff --git a/src/csharp/Grpc.Examples/MathExamples.cs b/src/csharp/Grpc.Examples/MathExamples.cs
index 8009ccbbfa..6075420974 100644
--- a/src/csharp/Grpc.Examples/MathExamples.cs
+++ b/src/csharp/Grpc.Examples/MathExamples.cs
@@ -1,5 +1,5 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -38,19 +38,19 @@ namespace Math
{
public static class MathExamples
{
- public static void DivExample(Math.IMathClient client)
+ public static void DivExample(Math.MathClient client)
{
DivReply result = client.Div(new DivArgs { Dividend = 10, Divisor = 3 });
Console.WriteLine("Div Result: " + result);
}
- public static async Task DivAsyncExample(Math.IMathClient client)
+ public static async Task DivAsyncExample(Math.MathClient client)
{
DivReply result = await client.DivAsync(new DivArgs { Dividend = 4, Divisor = 5 });
Console.WriteLine("DivAsync Result: " + result);
}
- public static async Task FibExample(Math.IMathClient client)
+ public static async Task FibExample(Math.MathClient client)
{
using (var call = client.Fib(new FibArgs { Limit = 5 }))
{
@@ -59,7 +59,7 @@ namespace Math
}
}
- public static async Task SumExample(Math.IMathClient client)
+ public static async Task SumExample(Math.MathClient client)
{
var numbers = new List<Num>
{
@@ -75,7 +75,7 @@ namespace Math
}
}
- public static async Task DivManyExample(Math.IMathClient client)
+ public static async Task DivManyExample(Math.MathClient client)
{
var divArgsList = new List<DivArgs>
{
@@ -90,7 +90,7 @@ namespace Math
}
}
- public static async Task DependendRequestsExample(Math.IMathClient client)
+ public static async Task DependendRequestsExample(Math.MathClient client)
{
var numbers = new List<Num>
{
diff --git a/src/csharp/Grpc.Examples/MathGrpc.cs b/src/csharp/Grpc.Examples/MathGrpc.cs
index a6e878d0f4..f3bb0d1cdc 100644
--- a/src/csharp/Grpc.Examples/MathGrpc.cs
+++ b/src/csharp/Grpc.Examples/MathGrpc.cs
@@ -52,6 +52,7 @@ namespace Math {
}
// client interface
+ [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IMathClient
{
global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
@@ -67,6 +68,7 @@ namespace Math {
}
// server-side interface
+ [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IMath
{
Task<global::Math.DivReply> Div(global::Math.DivArgs request, ServerCallContext context);
@@ -75,61 +77,92 @@ namespace Math {
Task<global::Math.Num> Sum(IAsyncStreamReader<global::Math.Num> requestStream, ServerCallContext context);
}
+ // server-side abstract class
+ public abstract class MathBase
+ {
+ public virtual Task<global::Math.DivReply> Div(global::Math.DivArgs request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task DivMany(IAsyncStreamReader<global::Math.DivArgs> requestStream, IServerStreamWriter<global::Math.DivReply> responseStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task Fib(global::Math.FibArgs request, IServerStreamWriter<global::Math.Num> responseStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task<global::Math.Num> Sum(IAsyncStreamReader<global::Math.Num> requestStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ }
+
// client stub
- public class MathClient : ClientBase, IMathClient
+ public class MathClient : ClientBase<MathClient>, IMathClient
{
public MathClient(Channel channel) : base(channel)
{
}
- public global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public MathClient(CallInvoker callInvoker) : base(callInvoker)
{
- var call = CreateCall(__Method_Div, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
}
- public global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options)
+ ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
+ protected MathClient() : base()
{
- var call = CreateCall(__Method_Div, options);
- return Calls.BlockingUnaryCall(call, request);
}
- public AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ ///<summary>Protected constructor to allow creation of configured clients.</summary>
+ protected MathClient(ClientBaseConfiguration configuration) : base(configuration)
{
- var call = CreateCall(__Method_Div, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
}
- public AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, CallOptions options)
+
+ public virtual global::Math.DivReply Div(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_Div, options);
- return Calls.AsyncUnaryCall(call, request);
+ return Div(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual global::Math.DivReply Div(global::Math.DivArgs request, CallOptions options)
{
- var call = CreateCall(__Method_DivMany, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncDuplexStreamingCall(call);
+ return CallInvoker.BlockingUnaryCall(__Method_Div, null, options, request);
}
- public AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(CallOptions options)
+ public virtual AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_DivMany, options);
- return Calls.AsyncDuplexStreamingCall(call);
+ return DivAsync(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncUnaryCall<global::Math.DivReply> DivAsync(global::Math.DivArgs request, CallOptions options)
{
- var call = CreateCall(__Method_Fib, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncServerStreamingCall(call, request);
+ return CallInvoker.AsyncUnaryCall(__Method_Div, null, options, request);
}
- public AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, CallOptions options)
+ public virtual AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_Fib, options);
- return Calls.AsyncServerStreamingCall(call, request);
+ return DivMany(new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncDuplexStreamingCall<global::Math.DivArgs, global::Math.DivReply> DivMany(CallOptions options)
{
- var call = CreateCall(__Method_Sum, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncClientStreamingCall(call);
+ return CallInvoker.AsyncDuplexStreamingCall(__Method_DivMany, null, options);
}
- public AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(CallOptions options)
+ public virtual AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_Sum, options);
- return Calls.AsyncClientStreamingCall(call);
+ return Fib(request, new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual AsyncServerStreamingCall<global::Math.Num> Fib(global::Math.FibArgs request, CallOptions options)
+ {
+ return CallInvoker.AsyncServerStreamingCall(__Method_Fib, null, options, request);
+ }
+ public virtual AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return Sum(new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual AsyncClientStreamingCall<global::Math.Num, global::Math.Num> Sum(CallOptions options)
+ {
+ return CallInvoker.AsyncClientStreamingCall(__Method_Sum, null, options);
+ }
+ protected override MathClient NewInstance(ClientBaseConfiguration configuration)
+ {
+ return new MathClient(configuration);
}
}
@@ -143,6 +176,16 @@ namespace Math {
.AddMethod(__Method_Sum, serviceImpl.Sum).Build();
}
+ // creates service definition that can be registered with a server
+ public static ServerServiceDefinition BindService(MathBase serviceImpl)
+ {
+ return ServerServiceDefinition.CreateBuilder(__ServiceName)
+ .AddMethod(__Method_Div, serviceImpl.Div)
+ .AddMethod(__Method_DivMany, serviceImpl.DivMany)
+ .AddMethod(__Method_Fib, serviceImpl.Fib)
+ .AddMethod(__Method_Sum, serviceImpl.Sum).Build();
+ }
+
// creates a new client
public static MathClient NewClient(Channel channel)
{
diff --git a/src/csharp/Grpc.Examples/MathServiceImpl.cs b/src/csharp/Grpc.Examples/MathServiceImpl.cs
index 71dc655e46..79c56e57a8 100644
--- a/src/csharp/Grpc.Examples/MathServiceImpl.cs
+++ b/src/csharp/Grpc.Examples/MathServiceImpl.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -43,14 +43,14 @@ namespace Math
/// <summary>
/// Implementation of MathService server
/// </summary>
- public class MathServiceImpl : Math.IMath
+ public class MathServiceImpl : Math.MathBase
{
- public Task<DivReply> Div(DivArgs request, ServerCallContext context)
+ public override Task<DivReply> Div(DivArgs request, ServerCallContext context)
{
return Task.FromResult(DivInternal(request));
}
- public async Task Fib(FibArgs request, IServerStreamWriter<Num> responseStream, ServerCallContext context)
+ public override async Task Fib(FibArgs request, IServerStreamWriter<Num> responseStream, ServerCallContext context)
{
if (request.Limit <= 0)
{
@@ -72,7 +72,7 @@ namespace Math
}
}
- public async Task<Num> Sum(IAsyncStreamReader<Num> requestStream, ServerCallContext context)
+ public override async Task<Num> Sum(IAsyncStreamReader<Num> requestStream, ServerCallContext context)
{
long sum = 0;
await requestStream.ForEachAsync(async num =>
@@ -82,7 +82,7 @@ namespace Math
return new Num { Num_ = sum };
}
- public async Task DivMany(IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream, ServerCallContext context)
+ public override async Task DivMany(IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream, ServerCallContext context)
{
await requestStream.ForEachAsync(async divArgs => await responseStream.WriteAsync(DivInternal(divArgs)));
}
diff --git a/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs b/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
index 8318e84277..fb292945a6 100644
--- a/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
+++ b/src/csharp/Grpc.HealthCheck.Tests/HealthClientServerTest.cs
@@ -49,7 +49,7 @@ namespace Grpc.HealthCheck.Tests
const string Host = "localhost";
Server server;
Channel channel;
- Grpc.Health.V1.Health.IHealthClient client;
+ Grpc.Health.V1.Health.HealthClient client;
Grpc.HealthCheck.HealthServiceImpl serviceImpl;
[TestFixtureSetUp]
diff --git a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs
index 68320eb5c2..72e11cca3a 100644
--- a/src/csharp/Grpc.HealthCheck/HealthGrpc.cs
+++ b/src/csharp/Grpc.HealthCheck/HealthGrpc.cs
@@ -29,6 +29,7 @@ namespace Grpc.Health.V1 {
}
// client interface
+ [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IHealthClient
{
global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
@@ -38,36 +39,59 @@ namespace Grpc.Health.V1 {
}
// server-side interface
+ [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IHealth
{
Task<global::Grpc.Health.V1.HealthCheckResponse> Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context);
}
+ // server-side abstract class
+ public abstract class HealthBase
+ {
+ public virtual Task<global::Grpc.Health.V1.HealthCheckResponse> Check(global::Grpc.Health.V1.HealthCheckRequest request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ }
+
// client stub
- public class HealthClient : ClientBase, IHealthClient
+ public class HealthClient : ClientBase<HealthClient>, IHealthClient
{
public HealthClient(Channel channel) : base(channel)
{
}
- public global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public HealthClient(CallInvoker callInvoker) : base(callInvoker)
{
- var call = CreateCall(__Method_Check, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
}
- public global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options)
+ ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
+ protected HealthClient() : base()
+ {
+ }
+ ///<summary>Protected constructor to allow creation of configured clients.</summary>
+ protected HealthClient(ClientBaseConfiguration configuration) : base(configuration)
+ {
+ }
+
+ public virtual global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_Check, options);
- return Calls.BlockingUnaryCall(call, request);
+ return Check(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual global::Grpc.Health.V1.HealthCheckResponse Check(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options)
{
- var call = CreateCall(__Method_Check, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
+ return CallInvoker.BlockingUnaryCall(__Method_Check, null, options, request);
}
- public AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options)
+ public virtual AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_Check, options);
- return Calls.AsyncUnaryCall(call, request);
+ return CheckAsync(request, new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual AsyncUnaryCall<global::Grpc.Health.V1.HealthCheckResponse> CheckAsync(global::Grpc.Health.V1.HealthCheckRequest request, CallOptions options)
+ {
+ return CallInvoker.AsyncUnaryCall(__Method_Check, null, options, request);
+ }
+ protected override HealthClient NewInstance(ClientBaseConfiguration configuration)
+ {
+ return new HealthClient(configuration);
}
}
@@ -78,6 +102,13 @@ namespace Grpc.Health.V1 {
.AddMethod(__Method_Check, serviceImpl.Check).Build();
}
+ // creates service definition that can be registered with a server
+ public static ServerServiceDefinition BindService(HealthBase serviceImpl)
+ {
+ return ServerServiceDefinition.CreateBuilder(__ServiceName)
+ .AddMethod(__Method_Check, serviceImpl.Check).Build();
+ }
+
// creates a new client
public static HealthClient NewClient(Channel channel)
{
diff --git a/src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs b/src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs
index a6e82aa0d4..d0406ece00 100644
--- a/src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs
+++ b/src/csharp/Grpc.HealthCheck/HealthServiceImpl.cs
@@ -51,7 +51,7 @@ namespace Grpc.HealthCheck
/// server.AddServiceDefinition(Grpc.Health.V1.Health.BindService(serviceImpl));
/// </code>
/// </summary>
- public class HealthServiceImpl : Grpc.Health.V1.Health.IHealth
+ public class HealthServiceImpl : Grpc.Health.V1.Health.HealthBase
{
private readonly object myLock = new object();
private readonly Dictionary<string, HealthCheckResponse.Types.ServingStatus> statusMap =
@@ -99,7 +99,7 @@ namespace Grpc.HealthCheck
/// <param name="request">The check request.</param>
/// <param name="context">The call context.</param>
/// <returns>The asynchronous response.</returns>
- public Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context)
+ public override Task<HealthCheckResponse> Check(HealthCheckRequest request, ServerCallContext context)
{
lock (myLock)
{
diff --git a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceImpl.cs b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceImpl.cs
index 7e7bc713a0..07f2703d4a 100644
--- a/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceImpl.cs
+++ b/src/csharp/Grpc.IntegrationTesting/BenchmarkServiceImpl.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -44,19 +44,19 @@ namespace Grpc.Testing
/// <summary>
/// Implementation of BenchmarkService server
/// </summary>
- public class BenchmarkServiceImpl : BenchmarkService.IBenchmarkService
+ public class BenchmarkServiceImpl : BenchmarkService.BenchmarkServiceBase
{
public BenchmarkServiceImpl()
{
}
- public Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
+ public override Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
{
var response = new SimpleResponse { Payload = CreateZerosPayload(request.ResponseSize) };
return Task.FromResult(response);
}
- public async Task StreamingCall(IAsyncStreamReader<SimpleRequest> requestStream, IServerStreamWriter<SimpleResponse> responseStream, ServerCallContext context)
+ public override async Task StreamingCall(IAsyncStreamReader<SimpleRequest> requestStream, IServerStreamWriter<SimpleResponse> responseStream, ServerCallContext context)
{
await requestStream.ForEachAsync(async request =>
{
diff --git a/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs b/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs
index 5bfc89d591..f954ca5f34 100644
--- a/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs
+++ b/src/csharp/Grpc.IntegrationTesting/ClientRunners.cs
@@ -61,15 +61,7 @@ namespace Grpc.IntegrationTesting
public static IClientRunner CreateStarted(ClientConfig config)
{
Logger.Debug("ClientConfig: {0}", config);
- string target = config.ServerTargets.Single();
- GrpcPreconditions.CheckArgument(config.LoadParams.LoadCase == LoadParams.LoadOneofCase.ClosedLoop,
- "Only closed loop scenario supported for C#");
- GrpcPreconditions.CheckArgument(config.ClientChannels == 1, "ClientConfig.ClientChannels needs to be 1");
- if (config.OutstandingRpcsPerChannel != 0)
- {
- Logger.Warning("ClientConfig.OutstandingRpcsPerChannel is not supported for C#. Ignoring the value");
- }
if (config.AsyncClientThreads != 0)
{
Logger.Warning("ClientConfig.AsyncClientThreads is not supported for C#. Ignoring the value");
@@ -83,22 +75,40 @@ namespace Grpc.IntegrationTesting
Logger.Warning("ClientConfig.CoreList is not supported for C#. Ignoring the value");
}
- var credentials = config.SecurityParams != null ? TestCredentials.CreateSslCredentials() : ChannelCredentials.Insecure;
+ var channels = CreateChannels(config.ClientChannels, config.ServerTargets, config.SecurityParams);
+
+ return new ClientRunnerImpl(channels,
+ config.ClientType,
+ config.RpcType,
+ config.OutstandingRpcsPerChannel,
+ config.LoadParams,
+ config.PayloadConfig,
+ config.HistogramParams);
+ }
+
+ private static List<Channel> CreateChannels(int clientChannels, IEnumerable<string> serverTargets, SecurityParams securityParams)
+ {
+ GrpcPreconditions.CheckArgument(clientChannels > 0, "clientChannels needs to be at least 1.");
+ GrpcPreconditions.CheckArgument(serverTargets.Count() > 0, "at least one serverTarget needs to be specified.");
+
+ var credentials = securityParams != null ? TestCredentials.CreateSslCredentials() : ChannelCredentials.Insecure;
List<ChannelOption> channelOptions = null;
- if (config.SecurityParams != null && config.SecurityParams.ServerHostOverride != "")
+ if (securityParams != null && securityParams.ServerHostOverride != "")
{
channelOptions = new List<ChannelOption>
{
- new ChannelOption(ChannelOptions.SslTargetNameOverride, config.SecurityParams.ServerHostOverride)
+ new ChannelOption(ChannelOptions.SslTargetNameOverride, securityParams.ServerHostOverride)
};
}
- var channel = new Channel(target, credentials, channelOptions);
- return new ClientRunnerImpl(channel,
- config.ClientType,
- config.RpcType,
- config.PayloadConfig,
- config.HistogramParams);
+ var result = new List<Channel>();
+ for (int i = 0; i < clientChannels; i++)
+ {
+ var target = serverTargets.ElementAt(i % serverTargets.Count());
+ var channel = new Channel(target, credentials, channelOptions);
+ result.Add(channel);
+ }
+ return result;
}
}
@@ -106,30 +116,35 @@ namespace Grpc.IntegrationTesting
{
const double SecondsToNanos = 1e9;
- readonly Channel channel;
+ readonly List<Channel> channels;
readonly ClientType clientType;
readonly RpcType rpcType;
readonly PayloadConfig payloadConfig;
readonly Histogram histogram;
- readonly BenchmarkService.IBenchmarkServiceClient client;
- readonly Task runnerTask;
- readonly CancellationTokenSource stoppedCts;
+ readonly List<Task> runnerTasks;
+ readonly CancellationTokenSource stoppedCts = new CancellationTokenSource();
readonly WallClockStopwatch wallClockStopwatch = new WallClockStopwatch();
- public ClientRunnerImpl(Channel channel, ClientType clientType, RpcType rpcType, PayloadConfig payloadConfig, HistogramParams histogramParams)
+ public ClientRunnerImpl(List<Channel> channels, ClientType clientType, RpcType rpcType, int outstandingRpcsPerChannel, LoadParams loadParams, PayloadConfig payloadConfig, HistogramParams histogramParams)
{
- this.channel = GrpcPreconditions.CheckNotNull(channel);
+ GrpcPreconditions.CheckArgument(outstandingRpcsPerChannel > 0, "outstandingRpcsPerChannel");
+ this.channels = new List<Channel>(channels);
this.clientType = clientType;
this.rpcType = rpcType;
this.payloadConfig = payloadConfig;
this.histogram = new Histogram(histogramParams.Resolution, histogramParams.MaxPossible);
- this.stoppedCts = new CancellationTokenSource();
- this.client = BenchmarkService.NewClient(channel);
-
- var threadBody = GetThreadBody();
- this.runnerTask = Task.Factory.StartNew(threadBody, TaskCreationOptions.LongRunning);
+ this.runnerTasks = new List<Task>();
+ foreach (var channel in this.channels)
+ {
+ for (int i = 0; i < outstandingRpcsPerChannel; i++)
+ {
+ var timer = CreateTimer(loadParams, 1.0 / this.channels.Count / outstandingRpcsPerChannel);
+ var threadBody = GetThreadBody(channel, timer);
+ this.runnerTasks.Add(Task.Factory.StartNew(threadBody, TaskCreationOptions.LongRunning));
+ }
+ }
}
public ClientStats GetStats(bool reset)
@@ -150,12 +165,19 @@ namespace Grpc.IntegrationTesting
public async Task StopAsync()
{
stoppedCts.Cancel();
- await runnerTask;
- await channel.ShutdownAsync();
+ foreach (var runnerTask in runnerTasks)
+ {
+ await runnerTask;
+ }
+ foreach (var channel in channels)
+ {
+ await channel.ShutdownAsync();
+ }
}
- private void RunClosedLoopUnary()
+ private void RunUnary(Channel channel, IInterarrivalTimer timer)
{
+ var client = BenchmarkService.NewClient(channel);
var request = CreateSimpleRequest();
var stopwatch = new Stopwatch();
@@ -167,11 +189,14 @@ namespace Grpc.IntegrationTesting
// spec requires data point in nanoseconds.
histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * SecondsToNanos);
+
+ timer.WaitForNext();
}
}
- private async Task RunClosedLoopUnaryAsync()
+ private async Task RunUnaryAsync(Channel channel, IInterarrivalTimer timer)
{
+ var client = BenchmarkService.NewClient(channel);
var request = CreateSimpleRequest();
var stopwatch = new Stopwatch();
@@ -183,11 +208,14 @@ namespace Grpc.IntegrationTesting
// spec requires data point in nanoseconds.
histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * SecondsToNanos);
+
+ await timer.WaitForNextAsync();
}
}
- private async Task RunClosedLoopStreamingAsync()
+ private async Task RunStreamingPingPongAsync(Channel channel, IInterarrivalTimer timer)
{
+ var client = BenchmarkService.NewClient(channel);
var request = CreateSimpleRequest();
var stopwatch = new Stopwatch();
@@ -202,6 +230,8 @@ namespace Grpc.IntegrationTesting
// spec requires data point in nanoseconds.
histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * SecondsToNanos);
+
+ await timer.WaitForNextAsync();
}
// finish the streaming call
@@ -210,7 +240,7 @@ namespace Grpc.IntegrationTesting
}
}
- private async Task RunGenericClosedLoopStreamingAsync()
+ private async Task RunGenericStreamingAsync(Channel channel, IInterarrivalTimer timer)
{
var request = CreateByteBufferRequest();
var stopwatch = new Stopwatch();
@@ -228,6 +258,8 @@ namespace Grpc.IntegrationTesting
// spec requires data point in nanoseconds.
histogram.AddObservation(stopwatch.Elapsed.TotalSeconds * SecondsToNanos);
+
+ await timer.WaitForNextAsync();
}
// finish the streaming call
@@ -236,7 +268,7 @@ namespace Grpc.IntegrationTesting
}
}
- private Action GetThreadBody()
+ private Action GetThreadBody(Channel channel, IInterarrivalTimer timer)
{
if (payloadConfig.PayloadCase == PayloadConfig.PayloadOneofCase.BytebufParams)
{
@@ -244,7 +276,7 @@ namespace Grpc.IntegrationTesting
GrpcPreconditions.CheckArgument(rpcType == RpcType.STREAMING, "Generic client only supports streaming calls");
return () =>
{
- RunGenericClosedLoopStreamingAsync().Wait();
+ RunGenericStreamingAsync(channel, timer).Wait();
};
}
@@ -252,7 +284,7 @@ namespace Grpc.IntegrationTesting
if (clientType == ClientType.SYNC_CLIENT)
{
GrpcPreconditions.CheckArgument(rpcType == RpcType.UNARY, "Sync client can only be used for Unary calls in C#");
- return RunClosedLoopUnary;
+ return () => RunUnary(channel, timer);
}
else if (clientType == ClientType.ASYNC_CLIENT)
{
@@ -261,12 +293,12 @@ namespace Grpc.IntegrationTesting
case RpcType.UNARY:
return () =>
{
- RunClosedLoopUnaryAsync().Wait();
+ RunUnaryAsync(channel, timer).Wait();
};
case RpcType.STREAMING:
return () =>
{
- RunClosedLoopStreamingAsync().Wait();
+ RunStreamingPingPongAsync(channel, timer).Wait();
};
}
}
@@ -292,5 +324,18 @@ namespace Grpc.IntegrationTesting
{
return new Payload { Body = ByteString.CopyFrom(new byte[size]) };
}
+
+ private static IInterarrivalTimer CreateTimer(LoadParams loadParams, double loadMultiplier)
+ {
+ switch (loadParams.LoadCase)
+ {
+ case LoadParams.LoadOneofCase.ClosedLoop:
+ return new ClosedLoopInterarrivalTimer();
+ case LoadParams.LoadOneofCase.Poisson:
+ return new PoissonInterarrivalTimer(loadParams.Poisson.OfferedLoad * loadMultiplier);
+ default:
+ throw new ArgumentException("Unknown load type");
+ }
+ }
}
}
diff --git a/src/csharp/Grpc.IntegrationTesting/GeneratedClientTest.cs b/src/csharp/Grpc.IntegrationTesting/GeneratedClientTest.cs
new file mode 100644
index 0000000000..37786b6c30
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting/GeneratedClientTest.cs
@@ -0,0 +1,106 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Grpc.Core;
+using Grpc.Core.Utils;
+using Grpc.Testing;
+using Moq;
+using NUnit.Framework;
+
+namespace Grpc.IntegrationTesting
+{
+ public class GeneratedClientTest
+ {
+ TestService.TestServiceClient unimplementedClient = new UnimplementedTestServiceClient();
+
+ [Test]
+ public void ExpandedParamOverloadCanBeMocked()
+ {
+ var expected = new SimpleResponse();
+
+ var mockClient = new Mock<TestService.TestServiceClient>();
+ // mocking is relatively clumsy because one needs to specify value for all the optional params.
+ mockClient.Setup(m => m.UnaryCall(It.IsAny<SimpleRequest>(), null, null, CancellationToken.None)).Returns(expected);
+
+ Assert.AreSame(expected, mockClient.Object.UnaryCall(new SimpleRequest()));
+ }
+
+ [Test]
+ public void CallOptionsOverloadCanBeMocked()
+ {
+ var expected = new SimpleResponse();
+
+ var mockClient = new Mock<TestService.TestServiceClient>();
+ mockClient.Setup(m => m.UnaryCall(It.IsAny<SimpleRequest>(), It.IsAny<CallOptions>())).Returns(expected);
+
+ Assert.AreSame(expected, mockClient.Object.UnaryCall(new SimpleRequest(), new CallOptions()));
+ }
+
+ [Test]
+ public void DefaultMethodStubThrows_UnaryCall()
+ {
+ Assert.Throws(typeof(NotImplementedException), () => unimplementedClient.UnaryCall(new SimpleRequest()));
+ }
+
+ [Test]
+ public void DefaultMethodStubThrows_ClientStreaming()
+ {
+ Assert.Throws(typeof(NotImplementedException), () => unimplementedClient.StreamingInputCall());
+ }
+
+ [Test]
+ public void DefaultMethodStubThrows_ServerStreaming()
+ {
+ Assert.Throws(typeof(NotImplementedException), () => unimplementedClient.StreamingOutputCall(new StreamingOutputCallRequest()));
+ }
+
+ [Test]
+ public void DefaultMethodStubThrows_DuplexStreaming()
+ {
+ Assert.Throws(typeof(NotImplementedException), () => unimplementedClient.FullDuplexCall());
+ }
+
+ /// <summary>
+ /// Subclass of the generated client that doesn't override any method stubs.
+ /// </summary>
+ private class UnimplementedTestServiceClient : TestService.TestServiceClient
+ {
+ }
+ }
+}
diff --git a/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs b/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs
new file mode 100644
index 0000000000..99aa729030
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting/GeneratedServiceBaseTest.cs
@@ -0,0 +1,116 @@
+#region Copyright notice and license
+
+// Copyright 2015-2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+using Grpc.Core;
+using Grpc.Core.Utils;
+using Grpc.Testing;
+using Moq;
+using NUnit.Framework;
+
+namespace Grpc.IntegrationTesting
+{
+ public class GeneratedServiceBaseTest
+ {
+ const string Host = "localhost";
+ Server server;
+ Channel channel;
+ TestService.TestServiceClient client;
+
+ [SetUp]
+ public void Init()
+ {
+ server = new Server
+ {
+ Services = { TestService.BindService(new UnimplementedTestServiceImpl()) },
+ Ports = { { Host, ServerPort.PickUnused, SslServerCredentials.Insecure } }
+ };
+ server.Start();
+ channel = new Channel(Host, server.Ports.Single().BoundPort, ChannelCredentials.Insecure);
+ client = TestService.NewClient(channel);
+ }
+
+ [TearDown]
+ public void Cleanup()
+ {
+ channel.ShutdownAsync().Wait();
+ server.ShutdownAsync().Wait();
+ }
+
+ [Test]
+ public void UnimplementedByDefault_Unary()
+ {
+ var ex = Assert.Throws<RpcException>(() => client.UnaryCall(new SimpleRequest { }));
+ Assert.AreEqual(StatusCode.Unimplemented, ex.Status.StatusCode);
+ }
+
+ [Test]
+ public async Task UnimplementedByDefault_ClientStreaming()
+ {
+ var call = client.StreamingInputCall();
+
+ var ex = Assert.Throws<RpcException>(async () => await call);
+ Assert.AreEqual(StatusCode.Unimplemented, ex.Status.StatusCode);
+ }
+
+ [Test]
+ public async Task UnimplementedByDefault_ServerStreamingCall()
+ {
+ var call = client.StreamingOutputCall(new StreamingOutputCallRequest());
+
+ var ex = Assert.Throws<RpcException>(async () => await call.ResponseStream.MoveNext());
+ Assert.AreEqual(StatusCode.Unimplemented, ex.Status.StatusCode);
+ }
+
+ [Test]
+ public async Task UnimplementedByDefault_DuplexStreamingCall()
+ {
+ var call = client.FullDuplexCall();
+
+ var ex = Assert.Throws<RpcException>(async () => await call.ResponseStream.MoveNext());
+ Assert.AreEqual(StatusCode.Unimplemented, ex.Status.StatusCode);
+ }
+
+ /// <summary>
+ /// Implementation of TestService that doesn't override any methods.
+ /// </summary>
+ private class UnimplementedTestServiceImpl : TestService.TestServiceBase
+ {
+ }
+ }
+}
diff --git a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
index d3c572fe27..7ea80b11f0 100644
--- a/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
+++ b/src/csharp/Grpc.IntegrationTesting/Grpc.IntegrationTesting.csproj
@@ -84,7 +84,6 @@
<Compile Include="..\Grpc.Core\Version.cs">
<Link>Version.cs</Link>
</Compile>
- <Compile Include="HeaderInterceptorTest.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Empty.cs" />
<Compile Include="Messages.cs" />
@@ -114,6 +113,9 @@
<Compile Include="QpsWorker.cs" />
<Compile Include="WallClockStopwatch.cs" />
<Compile Include="GenericService.cs" />
+ <Compile Include="GeneratedServiceBaseTest.cs" />
+ <Compile Include="GeneratedClientTest.cs" />
+ <Compile Include="InterarrivalTimers.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
diff --git a/src/csharp/Grpc.IntegrationTesting/InterarrivalTimers.cs b/src/csharp/Grpc.IntegrationTesting/InterarrivalTimers.cs
new file mode 100644
index 0000000000..6492d34890
--- /dev/null
+++ b/src/csharp/Grpc.IntegrationTesting/InterarrivalTimers.cs
@@ -0,0 +1,148 @@
+#region Copyright notice and license
+
+// Copyright 2016, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+using Google.Protobuf;
+using Grpc.Core;
+using Grpc.Core.Utils;
+using Grpc.Testing;
+
+namespace Grpc.IntegrationTesting
+{
+ public interface IInterarrivalTimer
+ {
+ void WaitForNext();
+
+ Task WaitForNextAsync();
+ }
+
+ /// <summary>
+ /// Interarrival timer that doesn't wait at all.
+ /// </summary>
+ public class ClosedLoopInterarrivalTimer : IInterarrivalTimer
+ {
+ public ClosedLoopInterarrivalTimer()
+ {
+ }
+
+ public void WaitForNext()
+ {
+ // NOP
+ }
+
+ public Task WaitForNextAsync()
+ {
+ return Task.FromResult<object>(null);
+ }
+ }
+
+ /// <summary>
+ /// Interarrival timer that generates Poisson process load.
+ /// </summary>
+ public class PoissonInterarrivalTimer : IInterarrivalTimer
+ {
+ readonly ExponentialDistribution exponentialDistribution;
+ DateTime? lastEventTime;
+
+ public PoissonInterarrivalTimer(double offeredLoad)
+ {
+ this.exponentialDistribution = new ExponentialDistribution(new Random(), offeredLoad);
+ this.lastEventTime = DateTime.UtcNow;
+ }
+
+ public void WaitForNext()
+ {
+ var waitDuration = GetNextWaitDuration();
+ int millisTimeout = (int) Math.Round(waitDuration.TotalMilliseconds);
+ if (millisTimeout > 0)
+ {
+ // TODO(jtattermusch): probably only works well for a relatively low interarrival rate
+ Thread.Sleep(millisTimeout);
+ }
+ }
+
+ public async Task WaitForNextAsync()
+ {
+ var waitDuration = GetNextWaitDuration();
+ int millisTimeout = (int) Math.Round(waitDuration.TotalMilliseconds);
+ if (millisTimeout > 0)
+ {
+ // TODO(jtattermusch): probably only works well for a relatively low interarrival rate
+ await Task.Delay(millisTimeout);
+ }
+ }
+
+ private TimeSpan GetNextWaitDuration()
+ {
+ if (!lastEventTime.HasValue)
+ {
+ this.lastEventTime = DateTime.Now;
+ }
+
+ var origLastEventTime = this.lastEventTime.Value;
+ this.lastEventTime = origLastEventTime + TimeSpan.FromSeconds(exponentialDistribution.Next());
+ return this.lastEventTime.Value - origLastEventTime;
+ }
+
+ /// <summary>
+ /// Exp generator.
+ /// </summary>
+ private class ExponentialDistribution
+ {
+ readonly Random random;
+ readonly double lambda;
+ readonly double lambdaReciprocal;
+
+ public ExponentialDistribution(Random random, double lambda)
+ {
+ this.random = random;
+ this.lambda = lambda;
+ this.lambdaReciprocal = 1.0 / lambda;
+ }
+
+ public double Next()
+ {
+ double uniform = random.NextDouble();
+ // Use 1.0-uni above to avoid NaN if uni is 0
+ return lambdaReciprocal * (-Math.Log(1.0 - uniform));
+ }
+ }
+ }
+}
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
index b0e33e49f7..7ca5221936 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClient.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -217,7 +217,7 @@ namespace Grpc.IntegrationTesting
}
}
- public static void RunEmptyUnary(TestService.ITestServiceClient client)
+ public static void RunEmptyUnary(TestService.TestServiceClient client)
{
Console.WriteLine("running empty_unary");
var response = client.EmptyCall(new Empty());
@@ -225,7 +225,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static void RunLargeUnary(TestService.ITestServiceClient client)
+ public static void RunLargeUnary(TestService.TestServiceClient client)
{
Console.WriteLine("running large_unary");
var request = new SimpleRequest
@@ -241,7 +241,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunClientStreamingAsync(TestService.ITestServiceClient client)
+ public static async Task RunClientStreamingAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running client_streaming");
@@ -257,7 +257,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunServerStreamingAsync(TestService.ITestServiceClient client)
+ public static async Task RunServerStreamingAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running server_streaming");
@@ -281,7 +281,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunPingPongAsync(TestService.ITestServiceClient client)
+ public static async Task RunPingPongAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running ping_pong");
@@ -338,7 +338,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunEmptyStreamAsync(TestService.ITestServiceClient client)
+ public static async Task RunEmptyStreamAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running empty_stream");
using (var call = client.FullDuplexCall())
@@ -434,7 +434,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunCancelAfterBeginAsync(TestService.ITestServiceClient client)
+ public static async Task RunCancelAfterBeginAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running cancel_after_begin");
@@ -451,7 +451,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunCancelAfterFirstResponseAsync(TestService.ITestServiceClient client)
+ public static async Task RunCancelAfterFirstResponseAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running cancel_after_first_response");
@@ -477,7 +477,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunTimeoutOnSleepingServerAsync(TestService.ITestServiceClient client)
+ public static async Task RunTimeoutOnSleepingServerAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running timeout_on_sleeping_server");
@@ -499,7 +499,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunCustomMetadataAsync(TestService.ITestServiceClient client)
+ public static async Task RunCustomMetadataAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running custom_metadata");
{
@@ -546,7 +546,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static async Task RunStatusCodeAndMessageAsync(TestService.ITestServiceClient client)
+ public static async Task RunStatusCodeAndMessageAsync(TestService.TestServiceClient client)
{
Console.WriteLine("running status_code_and_message");
var echoStatus = new EchoStatus
@@ -580,7 +580,7 @@ namespace Grpc.IntegrationTesting
Console.WriteLine("Passed!");
}
- public static void RunUnimplementedMethod(UnimplementedService.IUnimplementedServiceClient client)
+ public static void RunUnimplementedMethod(UnimplementedService.UnimplementedServiceClient client)
{
Console.WriteLine("running unimplemented_method");
var e = Assert.Throws<RpcException>(() => client.UnimplementedCall(new Empty()));
diff --git a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
index 5facb87971..4ee1ff5ec8 100644
--- a/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/InteropClientServerTest.cs
@@ -51,7 +51,7 @@ namespace Grpc.IntegrationTesting
const string Host = "localhost";
Server server;
Channel channel;
- TestService.ITestServiceClient client;
+ TestService.TestServiceClient client;
[TestFixtureSetUp]
public void Init()
diff --git a/src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs b/src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs
index 1c8bfed1f6..f95af5008f 100644
--- a/src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/MetadataCredentialsTest.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -50,15 +50,15 @@ namespace Grpc.IntegrationTesting
const string Host = "localhost";
Server server;
Channel channel;
- TestService.ITestServiceClient client;
+ TestService.TestServiceClient client;
List<ChannelOption> options;
- Mock<TestService.ITestService> serviceMock;
+ Mock<TestService.TestServiceBase> serviceMock;
AsyncAuthInterceptor asyncAuthInterceptor;
[SetUp]
public void Init()
{
- serviceMock = new Mock<TestService.ITestService>();
+ serviceMock = new Mock<TestService.TestServiceBase>();
serviceMock.Setup(m => m.UnaryCall(It.IsAny<SimpleRequest>(), It.IsAny<ServerCallContext>()))
.Returns(new Func<SimpleRequest, ServerCallContext, Task<SimpleResponse>>(UnaryCallHandler));
diff --git a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs
index 996439afbf..46b16cf202 100644
--- a/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs
+++ b/src/csharp/Grpc.IntegrationTesting/ServicesGrpc.cs
@@ -36,6 +36,7 @@ namespace Grpc.Testing {
}
// client interface
+ [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IBenchmarkServiceClient
{
global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
@@ -47,47 +48,73 @@ namespace Grpc.Testing {
}
// server-side interface
+ [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IBenchmarkService
{
Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context);
Task StreamingCall(IAsyncStreamReader<global::Grpc.Testing.SimpleRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.SimpleResponse> responseStream, ServerCallContext context);
}
+ // server-side abstract class
+ public abstract class BenchmarkServiceBase
+ {
+ public virtual Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task StreamingCall(IAsyncStreamReader<global::Grpc.Testing.SimpleRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.SimpleResponse> responseStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ }
+
// client stub
- public class BenchmarkServiceClient : ClientBase, IBenchmarkServiceClient
+ public class BenchmarkServiceClient : ClientBase<BenchmarkServiceClient>, IBenchmarkServiceClient
{
public BenchmarkServiceClient(Channel channel) : base(channel)
{
}
- public global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public BenchmarkServiceClient(CallInvoker callInvoker) : base(callInvoker)
+ {
+ }
+ ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
+ protected BenchmarkServiceClient() : base()
{
- var call = CreateCall(__Method_UnaryCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
}
- public global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
+ ///<summary>Protected constructor to allow creation of configured clients.</summary>
+ protected BenchmarkServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
- var call = CreateCall(__Method_UnaryCall, options);
- return Calls.BlockingUnaryCall(call, request);
}
- public AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+
+ public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_UnaryCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
+ return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
+ public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{
- var call = CreateCall(__Method_UnaryCall, options);
- return Calls.AsyncUnaryCall(call, request);
+ return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request);
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_StreamingCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncDuplexStreamingCall(call);
+ return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(CallOptions options)
+ public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{
- var call = CreateCall(__Method_StreamingCall, options);
- return Calls.AsyncDuplexStreamingCall(call);
+ return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request);
+ }
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return StreamingCall(new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.SimpleRequest, global::Grpc.Testing.SimpleResponse> StreamingCall(CallOptions options)
+ {
+ return CallInvoker.AsyncDuplexStreamingCall(__Method_StreamingCall, null, options);
+ }
+ protected override BenchmarkServiceClient NewInstance(ClientBaseConfiguration configuration)
+ {
+ return new BenchmarkServiceClient(configuration);
}
}
@@ -99,6 +126,14 @@ namespace Grpc.Testing {
.AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build();
}
+ // creates service definition that can be registered with a server
+ public static ServerServiceDefinition BindService(BenchmarkServiceBase serviceImpl)
+ {
+ return ServerServiceDefinition.CreateBuilder(__ServiceName)
+ .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall)
+ .AddMethod(__Method_StreamingCall, serviceImpl.StreamingCall).Build();
+ }
+
// creates a new client
public static BenchmarkServiceClient NewClient(Channel channel)
{
@@ -153,6 +188,7 @@ namespace Grpc.Testing {
}
// client interface
+ [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IWorkerServiceClient
{
AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
@@ -170,6 +206,7 @@ namespace Grpc.Testing {
}
// server-side interface
+ [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IWorkerService
{
Task RunServer(IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, ServerCallContext context);
@@ -178,71 +215,100 @@ namespace Grpc.Testing {
Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context);
}
+ // server-side abstract class
+ public abstract class WorkerServiceBase
+ {
+ public virtual Task RunServer(IAsyncStreamReader<global::Grpc.Testing.ServerArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ServerStatus> responseStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task RunClient(IAsyncStreamReader<global::Grpc.Testing.ClientArgs> requestStream, IServerStreamWriter<global::Grpc.Testing.ClientStatus> responseStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task<global::Grpc.Testing.CoreResponse> CoreCount(global::Grpc.Testing.CoreRequest request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task<global::Grpc.Testing.Void> QuitWorker(global::Grpc.Testing.Void request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ }
+
// client stub
- public class WorkerServiceClient : ClientBase, IWorkerServiceClient
+ public class WorkerServiceClient : ClientBase<WorkerServiceClient>, IWorkerServiceClient
{
public WorkerServiceClient(Channel channel) : base(channel)
{
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public WorkerServiceClient(CallInvoker callInvoker) : base(callInvoker)
{
- var call = CreateCall(__Method_RunServer, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncDuplexStreamingCall(call);
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(CallOptions options)
+ ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
+ protected WorkerServiceClient() : base()
{
- var call = CreateCall(__Method_RunServer, options);
- return Calls.AsyncDuplexStreamingCall(call);
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ ///<summary>Protected constructor to allow creation of configured clients.</summary>
+ protected WorkerServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
- var call = CreateCall(__Method_RunClient, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncDuplexStreamingCall(call);
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(CallOptions options)
+
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_RunClient, options);
- return Calls.AsyncDuplexStreamingCall(call);
+ return RunServer(new CallOptions(headers, deadline, cancellationToken));
}
- public global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ServerArgs, global::Grpc.Testing.ServerStatus> RunServer(CallOptions options)
{
- var call = CreateCall(__Method_CoreCount, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
+ return CallInvoker.AsyncDuplexStreamingCall(__Method_RunServer, null, options);
}
- public global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options)
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_CoreCount, options);
- return Calls.BlockingUnaryCall(call, request);
+ return RunClient(new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.ClientArgs, global::Grpc.Testing.ClientStatus> RunClient(CallOptions options)
{
- var call = CreateCall(__Method_CoreCount, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
+ return CallInvoker.AsyncDuplexStreamingCall(__Method_RunClient, null, options);
}
- public AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options)
+ public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_CoreCount, options);
- return Calls.AsyncUnaryCall(call, request);
+ return CoreCount(request, new CallOptions(headers, deadline, cancellationToken));
}
- public global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual global::Grpc.Testing.CoreResponse CoreCount(global::Grpc.Testing.CoreRequest request, CallOptions options)
{
- var call = CreateCall(__Method_QuitWorker, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
+ return CallInvoker.BlockingUnaryCall(__Method_CoreCount, null, options, request);
}
- public global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options)
+ public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_QuitWorker, options);
- return Calls.BlockingUnaryCall(call, request);
+ return CoreCountAsync(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncUnaryCall<global::Grpc.Testing.CoreResponse> CoreCountAsync(global::Grpc.Testing.CoreRequest request, CallOptions options)
{
- var call = CreateCall(__Method_QuitWorker, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
+ return CallInvoker.AsyncUnaryCall(__Method_CoreCount, null, options, request);
}
- public AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options)
+ public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_QuitWorker, options);
- return Calls.AsyncUnaryCall(call, request);
+ return QuitWorker(request, new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual global::Grpc.Testing.Void QuitWorker(global::Grpc.Testing.Void request, CallOptions options)
+ {
+ return CallInvoker.BlockingUnaryCall(__Method_QuitWorker, null, options, request);
+ }
+ public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return QuitWorkerAsync(request, new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual AsyncUnaryCall<global::Grpc.Testing.Void> QuitWorkerAsync(global::Grpc.Testing.Void request, CallOptions options)
+ {
+ return CallInvoker.AsyncUnaryCall(__Method_QuitWorker, null, options, request);
+ }
+ protected override WorkerServiceClient NewInstance(ClientBaseConfiguration configuration)
+ {
+ return new WorkerServiceClient(configuration);
}
}
@@ -256,6 +322,16 @@ namespace Grpc.Testing {
.AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build();
}
+ // creates service definition that can be registered with a server
+ public static ServerServiceDefinition BindService(WorkerServiceBase serviceImpl)
+ {
+ return ServerServiceDefinition.CreateBuilder(__ServiceName)
+ .AddMethod(__Method_RunServer, serviceImpl.RunServer)
+ .AddMethod(__Method_RunClient, serviceImpl.RunClient)
+ .AddMethod(__Method_CoreCount, serviceImpl.CoreCount)
+ .AddMethod(__Method_QuitWorker, serviceImpl.QuitWorker).Build();
+ }
+
// creates a new client
public static WorkerServiceClient NewClient(Channel channel)
{
diff --git a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
index 37b2518c21..3df45b5f70 100644
--- a/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
+++ b/src/csharp/Grpc.IntegrationTesting/SslCredentialsTest.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -53,7 +53,7 @@ namespace Grpc.IntegrationTesting
const string Host = "localhost";
Server server;
Channel channel;
- TestService.ITestServiceClient client;
+ TestService.TestServiceClient client;
[TestFixtureSetUp]
public void Init()
diff --git a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
index 2c469080d9..b84ec2d984 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestGrpc.cs
@@ -69,6 +69,7 @@ namespace Grpc.Testing {
}
// client interface
+ [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface ITestServiceClient
{
global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
@@ -90,6 +91,7 @@ namespace Grpc.Testing {
}
// server-side interface
+ [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface ITestService
{
Task<global::Grpc.Testing.Empty> EmptyCall(global::Grpc.Testing.Empty request, ServerCallContext context);
@@ -100,91 +102,126 @@ namespace Grpc.Testing {
Task HalfDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context);
}
+ // server-side abstract class
+ public abstract class TestServiceBase
+ {
+ public virtual Task<global::Grpc.Testing.Empty> EmptyCall(global::Grpc.Testing.Empty request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task<global::Grpc.Testing.SimpleResponse> UnaryCall(global::Grpc.Testing.SimpleRequest request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task<global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<global::Grpc.Testing.StreamingInputCallRequest> requestStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task FullDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task HalfDuplexCall(IAsyncStreamReader<global::Grpc.Testing.StreamingOutputCallRequest> requestStream, IServerStreamWriter<global::Grpc.Testing.StreamingOutputCallResponse> responseStream, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ }
+
// client stub
- public class TestServiceClient : ClientBase, ITestServiceClient
+ public class TestServiceClient : ClientBase<TestServiceClient>, ITestServiceClient
{
public TestServiceClient(Channel channel) : base(channel)
{
}
- public global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public TestServiceClient(CallInvoker callInvoker) : base(callInvoker)
+ {
+ }
+ ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
+ protected TestServiceClient() : base()
+ {
+ }
+ ///<summary>Protected constructor to allow creation of configured clients.</summary>
+ protected TestServiceClient(ClientBaseConfiguration configuration) : base(configuration)
+ {
+ }
+
+ public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_EmptyCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
+ return EmptyCall(request, new CallOptions(headers, deadline, cancellationToken));
}
- public global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, CallOptions options)
+ public virtual global::Grpc.Testing.Empty EmptyCall(global::Grpc.Testing.Empty request, CallOptions options)
{
- var call = CreateCall(__Method_EmptyCall, options);
- return Calls.BlockingUnaryCall(call, request);
+ return CallInvoker.BlockingUnaryCall(__Method_EmptyCall, null, options, request);
}
- public AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_EmptyCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
+ return EmptyCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, CallOptions options)
+ public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> EmptyCallAsync(global::Grpc.Testing.Empty request, CallOptions options)
{
- var call = CreateCall(__Method_EmptyCall, options);
- return Calls.AsyncUnaryCall(call, request);
+ return CallInvoker.AsyncUnaryCall(__Method_EmptyCall, null, options, request);
}
- public global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_UnaryCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
+ return UnaryCall(request, new CallOptions(headers, deadline, cancellationToken));
}
- public global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
+ public virtual global::Grpc.Testing.SimpleResponse UnaryCall(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{
- var call = CreateCall(__Method_UnaryCall, options);
- return Calls.BlockingUnaryCall(call, request);
+ return CallInvoker.BlockingUnaryCall(__Method_UnaryCall, null, options, request);
}
- public AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_UnaryCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
+ return UnaryCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
+ public virtual AsyncUnaryCall<global::Grpc.Testing.SimpleResponse> UnaryCallAsync(global::Grpc.Testing.SimpleRequest request, CallOptions options)
{
- var call = CreateCall(__Method_UnaryCall, options);
- return Calls.AsyncUnaryCall(call, request);
+ return CallInvoker.AsyncUnaryCall(__Method_UnaryCall, null, options, request);
}
- public AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_StreamingOutputCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncServerStreamingCall(call, request);
+ return StreamingOutputCall(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, CallOptions options)
+ public virtual AsyncServerStreamingCall<global::Grpc.Testing.StreamingOutputCallResponse> StreamingOutputCall(global::Grpc.Testing.StreamingOutputCallRequest request, CallOptions options)
{
- var call = CreateCall(__Method_StreamingOutputCall, options);
- return Calls.AsyncServerStreamingCall(call, request);
+ return CallInvoker.AsyncServerStreamingCall(__Method_StreamingOutputCall, null, options, request);
}
- public AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_StreamingInputCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncClientStreamingCall(call);
+ return StreamingInputCall(new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(CallOptions options)
+ public virtual AsyncClientStreamingCall<global::Grpc.Testing.StreamingInputCallRequest, global::Grpc.Testing.StreamingInputCallResponse> StreamingInputCall(CallOptions options)
{
- var call = CreateCall(__Method_StreamingInputCall, options);
- return Calls.AsyncClientStreamingCall(call);
+ return CallInvoker.AsyncClientStreamingCall(__Method_StreamingInputCall, null, options);
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_FullDuplexCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncDuplexStreamingCall(call);
+ return FullDuplexCall(new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(CallOptions options)
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> FullDuplexCall(CallOptions options)
{
- var call = CreateCall(__Method_FullDuplexCall, options);
- return Calls.AsyncDuplexStreamingCall(call);
+ return CallInvoker.AsyncDuplexStreamingCall(__Method_FullDuplexCall, null, options);
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_HalfDuplexCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncDuplexStreamingCall(call);
+ return HalfDuplexCall(new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(CallOptions options)
+ public virtual AsyncDuplexStreamingCall<global::Grpc.Testing.StreamingOutputCallRequest, global::Grpc.Testing.StreamingOutputCallResponse> HalfDuplexCall(CallOptions options)
{
- var call = CreateCall(__Method_HalfDuplexCall, options);
- return Calls.AsyncDuplexStreamingCall(call);
+ return CallInvoker.AsyncDuplexStreamingCall(__Method_HalfDuplexCall, null, options);
+ }
+ protected override TestServiceClient NewInstance(ClientBaseConfiguration configuration)
+ {
+ return new TestServiceClient(configuration);
}
}
@@ -200,6 +237,18 @@ namespace Grpc.Testing {
.AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall).Build();
}
+ // creates service definition that can be registered with a server
+ public static ServerServiceDefinition BindService(TestServiceBase serviceImpl)
+ {
+ return ServerServiceDefinition.CreateBuilder(__ServiceName)
+ .AddMethod(__Method_EmptyCall, serviceImpl.EmptyCall)
+ .AddMethod(__Method_UnaryCall, serviceImpl.UnaryCall)
+ .AddMethod(__Method_StreamingOutputCall, serviceImpl.StreamingOutputCall)
+ .AddMethod(__Method_StreamingInputCall, serviceImpl.StreamingInputCall)
+ .AddMethod(__Method_FullDuplexCall, serviceImpl.FullDuplexCall)
+ .AddMethod(__Method_HalfDuplexCall, serviceImpl.HalfDuplexCall).Build();
+ }
+
// creates a new client
public static TestServiceClient NewClient(Channel channel)
{
@@ -227,6 +276,7 @@ namespace Grpc.Testing {
}
// client interface
+ [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IUnimplementedServiceClient
{
global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
@@ -236,36 +286,59 @@ namespace Grpc.Testing {
}
// server-side interface
+ [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IUnimplementedService
{
Task<global::Grpc.Testing.Empty> UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context);
}
+ // server-side abstract class
+ public abstract class UnimplementedServiceBase
+ {
+ public virtual Task<global::Grpc.Testing.Empty> UnimplementedCall(global::Grpc.Testing.Empty request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ }
+
// client stub
- public class UnimplementedServiceClient : ClientBase, IUnimplementedServiceClient
+ public class UnimplementedServiceClient : ClientBase<UnimplementedServiceClient>, IUnimplementedServiceClient
{
public UnimplementedServiceClient(Channel channel) : base(channel)
{
}
- public global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public UnimplementedServiceClient(CallInvoker callInvoker) : base(callInvoker)
+ {
+ }
+ ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
+ protected UnimplementedServiceClient() : base()
+ {
+ }
+ ///<summary>Protected constructor to allow creation of configured clients.</summary>
+ protected UnimplementedServiceClient(ClientBaseConfiguration configuration) : base(configuration)
+ {
+ }
+
+ public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return UnimplementedCall(request, new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options)
{
- var call = CreateCall(__Method_UnimplementedCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
+ return CallInvoker.BlockingUnaryCall(__Method_UnimplementedCall, null, options, request);
}
- public global::Grpc.Testing.Empty UnimplementedCall(global::Grpc.Testing.Empty request, CallOptions options)
+ public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_UnimplementedCall, options);
- return Calls.BlockingUnaryCall(call, request);
+ return UnimplementedCallAsync(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options)
{
- var call = CreateCall(__Method_UnimplementedCall, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
+ return CallInvoker.AsyncUnaryCall(__Method_UnimplementedCall, null, options, request);
}
- public AsyncUnaryCall<global::Grpc.Testing.Empty> UnimplementedCallAsync(global::Grpc.Testing.Empty request, CallOptions options)
+ protected override UnimplementedServiceClient NewInstance(ClientBaseConfiguration configuration)
{
- var call = CreateCall(__Method_UnimplementedCall, options);
- return Calls.AsyncUnaryCall(call, request);
+ return new UnimplementedServiceClient(configuration);
}
}
@@ -276,6 +349,13 @@ namespace Grpc.Testing {
.AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build();
}
+ // creates service definition that can be registered with a server
+ public static ServerServiceDefinition BindService(UnimplementedServiceBase serviceImpl)
+ {
+ return ServerServiceDefinition.CreateBuilder(__ServiceName)
+ .AddMethod(__Method_UnimplementedCall, serviceImpl.UnimplementedCall).Build();
+ }
+
// creates a new client
public static UnimplementedServiceClient NewClient(Channel channel)
{
@@ -311,6 +391,7 @@ namespace Grpc.Testing {
}
// client interface
+ [System.Obsolete("Client side interfaced will be removed in the next release. Use client class directly.")]
public interface IReconnectServiceClient
{
global::Grpc.Testing.Empty Start(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken));
@@ -324,57 +405,81 @@ namespace Grpc.Testing {
}
// server-side interface
+ [System.Obsolete("Service implementations should inherit from the generated abstract base class instead.")]
public interface IReconnectService
{
Task<global::Grpc.Testing.Empty> Start(global::Grpc.Testing.Empty request, ServerCallContext context);
Task<global::Grpc.Testing.ReconnectInfo> Stop(global::Grpc.Testing.Empty request, ServerCallContext context);
}
+ // server-side abstract class
+ public abstract class ReconnectServiceBase
+ {
+ public virtual Task<global::Grpc.Testing.Empty> Start(global::Grpc.Testing.Empty request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ public virtual Task<global::Grpc.Testing.ReconnectInfo> Stop(global::Grpc.Testing.Empty request, ServerCallContext context)
+ {
+ throw new RpcException(new Status(StatusCode.Unimplemented, ""));
+ }
+
+ }
+
// client stub
- public class ReconnectServiceClient : ClientBase, IReconnectServiceClient
+ public class ReconnectServiceClient : ClientBase<ReconnectServiceClient>, IReconnectServiceClient
{
public ReconnectServiceClient(Channel channel) : base(channel)
{
}
- public global::Grpc.Testing.Empty Start(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public ReconnectServiceClient(CallInvoker callInvoker) : base(callInvoker)
{
- var call = CreateCall(__Method_Start, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
}
- public global::Grpc.Testing.Empty Start(global::Grpc.Testing.Empty request, CallOptions options)
+ ///<summary>Protected parameterless constructor to allow creation of test doubles.</summary>
+ protected ReconnectServiceClient() : base()
{
- var call = CreateCall(__Method_Start, options);
- return Calls.BlockingUnaryCall(call, request);
}
- public AsyncUnaryCall<global::Grpc.Testing.Empty> StartAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ ///<summary>Protected constructor to allow creation of configured clients.</summary>
+ protected ReconnectServiceClient(ClientBaseConfiguration configuration) : base(configuration)
{
- var call = CreateCall(__Method_Start, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
}
- public AsyncUnaryCall<global::Grpc.Testing.Empty> StartAsync(global::Grpc.Testing.Empty request, CallOptions options)
+
+ public virtual global::Grpc.Testing.Empty Start(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_Start, options);
- return Calls.AsyncUnaryCall(call, request);
+ return Start(request, new CallOptions(headers, deadline, cancellationToken));
}
- public global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual global::Grpc.Testing.Empty Start(global::Grpc.Testing.Empty request, CallOptions options)
{
- var call = CreateCall(__Method_Stop, new CallOptions(headers, deadline, cancellationToken));
- return Calls.BlockingUnaryCall(call, request);
+ return CallInvoker.BlockingUnaryCall(__Method_Start, null, options, request);
}
- public global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, CallOptions options)
+ public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> StartAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_Stop, options);
- return Calls.BlockingUnaryCall(call, request);
+ return StartAsync(request, new CallOptions(headers, deadline, cancellationToken));
}
- public AsyncUnaryCall<global::Grpc.Testing.ReconnectInfo> StopAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ public virtual AsyncUnaryCall<global::Grpc.Testing.Empty> StartAsync(global::Grpc.Testing.Empty request, CallOptions options)
{
- var call = CreateCall(__Method_Stop, new CallOptions(headers, deadline, cancellationToken));
- return Calls.AsyncUnaryCall(call, request);
+ return CallInvoker.AsyncUnaryCall(__Method_Start, null, options, request);
}
- public AsyncUnaryCall<global::Grpc.Testing.ReconnectInfo> StopAsync(global::Grpc.Testing.Empty request, CallOptions options)
+ public virtual global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
{
- var call = CreateCall(__Method_Stop, options);
- return Calls.AsyncUnaryCall(call, request);
+ return Stop(request, new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual global::Grpc.Testing.ReconnectInfo Stop(global::Grpc.Testing.Empty request, CallOptions options)
+ {
+ return CallInvoker.BlockingUnaryCall(__Method_Stop, null, options, request);
+ }
+ public virtual AsyncUnaryCall<global::Grpc.Testing.ReconnectInfo> StopAsync(global::Grpc.Testing.Empty request, Metadata headers = null, DateTime? deadline = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ return StopAsync(request, new CallOptions(headers, deadline, cancellationToken));
+ }
+ public virtual AsyncUnaryCall<global::Grpc.Testing.ReconnectInfo> StopAsync(global::Grpc.Testing.Empty request, CallOptions options)
+ {
+ return CallInvoker.AsyncUnaryCall(__Method_Stop, null, options, request);
+ }
+ protected override ReconnectServiceClient NewInstance(ClientBaseConfiguration configuration)
+ {
+ return new ReconnectServiceClient(configuration);
}
}
@@ -386,6 +491,14 @@ namespace Grpc.Testing {
.AddMethod(__Method_Stop, serviceImpl.Stop).Build();
}
+ // creates service definition that can be registered with a server
+ public static ServerServiceDefinition BindService(ReconnectServiceBase serviceImpl)
+ {
+ return ServerServiceDefinition.CreateBuilder(__ServiceName)
+ .AddMethod(__Method_Start, serviceImpl.Start)
+ .AddMethod(__Method_Stop, serviceImpl.Stop).Build();
+ }
+
// creates a new client
public static ReconnectServiceClient NewClient(Channel channel)
{
diff --git a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
index 5a1b4cf319..354318e80e 100644
--- a/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
+++ b/src/csharp/Grpc.IntegrationTesting/TestServiceImpl.cs
@@ -1,6 +1,6 @@
#region Copyright notice and license
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -45,14 +45,14 @@ namespace Grpc.Testing
/// <summary>
/// Implementation of TestService server
/// </summary>
- public class TestServiceImpl : TestService.ITestService
+ public class TestServiceImpl : TestService.TestServiceBase
{
- public Task<Empty> EmptyCall(Empty request, ServerCallContext context)
+ public override Task<Empty> EmptyCall(Empty request, ServerCallContext context)
{
return Task.FromResult(new Empty());
}
- public async Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
+ public override async Task<SimpleResponse> UnaryCall(SimpleRequest request, ServerCallContext context)
{
await EnsureEchoMetadataAsync(context);
EnsureEchoStatus(request.ResponseStatus, context);
@@ -61,7 +61,7 @@ namespace Grpc.Testing
return response;
}
- public async Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
+ public override async Task StreamingOutputCall(StreamingOutputCallRequest request, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
{
await EnsureEchoMetadataAsync(context);
EnsureEchoStatus(request.ResponseStatus, context);
@@ -73,7 +73,7 @@ namespace Grpc.Testing
}
}
- public async Task<StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<StreamingInputCallRequest> requestStream, ServerCallContext context)
+ public override async Task<StreamingInputCallResponse> StreamingInputCall(IAsyncStreamReader<StreamingInputCallRequest> requestStream, ServerCallContext context)
{
await EnsureEchoMetadataAsync(context);
@@ -85,7 +85,7 @@ namespace Grpc.Testing
return new StreamingInputCallResponse { AggregatedPayloadSize = sum };
}
- public async Task FullDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
+ public override async Task FullDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
{
await EnsureEchoMetadataAsync(context);
@@ -100,7 +100,7 @@ namespace Grpc.Testing
});
}
- public async Task HalfDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
+ public override async Task HalfDuplexCall(IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream, ServerCallContext context)
{
throw new NotImplementedException();
}
diff --git a/src/csharp/Grpc.IntegrationTesting/WorkerServiceImpl.cs b/src/csharp/Grpc.IntegrationTesting/WorkerServiceImpl.cs
index e5ad0caa03..80dad9fdd9 100644
--- a/src/csharp/Grpc.IntegrationTesting/WorkerServiceImpl.cs
+++ b/src/csharp/Grpc.IntegrationTesting/WorkerServiceImpl.cs
@@ -45,7 +45,7 @@ namespace Grpc.Testing
/// <summary>
/// Implementation of WorkerService server
/// </summary>
- public class WorkerServiceImpl : WorkerService.IWorkerService
+ public class WorkerServiceImpl : WorkerService.WorkerServiceBase
{
readonly Action stopRequestHandler;
@@ -54,7 +54,7 @@ namespace Grpc.Testing
this.stopRequestHandler = GrpcPreconditions.CheckNotNull(stopRequestHandler);
}
- public async Task RunServer(IAsyncStreamReader<ServerArgs> requestStream, IServerStreamWriter<ServerStatus> responseStream, ServerCallContext context)
+ public override async Task RunServer(IAsyncStreamReader<ServerArgs> requestStream, IServerStreamWriter<ServerStatus> responseStream, ServerCallContext context)
{
GrpcPreconditions.CheckState(await requestStream.MoveNext());
var serverConfig = requestStream.Current.Setup;
@@ -78,7 +78,7 @@ namespace Grpc.Testing
await runner.StopAsync();
}
- public async Task RunClient(IAsyncStreamReader<ClientArgs> requestStream, IServerStreamWriter<ClientStatus> responseStream, ServerCallContext context)
+ public override async Task RunClient(IAsyncStreamReader<ClientArgs> requestStream, IServerStreamWriter<ClientStatus> responseStream, ServerCallContext context)
{
GrpcPreconditions.CheckState(await requestStream.MoveNext());
var clientConfig = requestStream.Current.Setup;
@@ -100,12 +100,12 @@ namespace Grpc.Testing
await runner.StopAsync();
}
- public Task<CoreResponse> CoreCount(CoreRequest request, ServerCallContext context)
+ public override Task<CoreResponse> CoreCount(CoreRequest request, ServerCallContext context)
{
return Task.FromResult(new CoreResponse { Cores = Environment.ProcessorCount });
}
- public Task<Void> QuitWorker(Void request, ServerCallContext context)
+ public override Task<Void> QuitWorker(Void request, ServerCallContext context)
{
stopRequestHandler();
return Task.FromResult(new Void());
diff --git a/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec b/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec
index 6a1795b709..cc688e2bc7 100644
--- a/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec
+++ b/src/csharp/grpc.native.csharp/grpc.native.csharp.nuspec
@@ -10,7 +10,7 @@
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Native extension needed by gRPC C# library. This is not the package you are looking for, it is only meant to be used as a dependency.</description>
<releaseNotes>Release of gRPC C core $version$ libraries.</releaseNotes>
- <copyright>Copyright 2015-2016</copyright>
+ <copyright>Copyright 2015</copyright>
<title>gRPC C# Native Extension</title>
<summary>Native library required by gRPC C#</summary>
<tags>gRPC native</tags>
diff --git a/src/csharp/tests.json b/src/csharp/tests.json
index d66cb1b100..718bfa3287 100644
--- a/src/csharp/tests.json
+++ b/src/csharp/tests.json
@@ -36,8 +36,9 @@
"Math.Tests.MathClientServerTest",
"Grpc.HealthCheck.Tests.HealthClientServerTest",
"Grpc.HealthCheck.Tests.HealthServiceImplTest",
- "Grpc.IntegrationTesting.HeaderInterceptorTest",
"Grpc.IntegrationTesting.HistogramTest",
+ "Grpc.IntegrationTesting.GeneratedClientTest",
+ "Grpc.IntegrationTesting.GeneratedServiceBaseTest",
"Grpc.IntegrationTesting.InteropClientServerTest",
"Grpc.IntegrationTesting.MetadataCredentialsTest",
"Grpc.IntegrationTesting.RunnerClientServerTest",
diff --git a/src/proto/grpc/testing/messages.proto b/src/proto/grpc/testing/messages.proto
index 193b6c4171..a063b470c7 100644
--- a/src/proto/grpc/testing/messages.proto
+++ b/src/proto/grpc/testing/messages.proto
@@ -1,5 +1,5 @@
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -159,6 +159,12 @@ message StreamingOutputCallResponse {
}
// For reconnect interop test only.
+// Client tells server what reconnection parameters it used.
+message ReconnectParams {
+ int32 max_reconnect_backoff_ms = 1;
+}
+
+// For reconnect interop test only.
// Server tells client whether its reconnects are following the spec and the
// reconnect backoffs it saw.
message ReconnectInfo {
diff --git a/src/proto/grpc/testing/metrics.proto b/src/proto/grpc/testing/metrics.proto
index 0cc4b60239..1202b20b8f 100644
--- a/src/proto/grpc/testing/metrics.proto
+++ b/src/proto/grpc/testing/metrics.proto
@@ -1,4 +1,4 @@
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -42,7 +42,7 @@ message GaugeResponse {
string name = 1;
oneof value {
int64 long_value = 2;
- double double_vale = 3;
+ double double_value = 3;
string string_value = 4;
}
}
diff --git a/src/proto/grpc/testing/test.proto b/src/proto/grpc/testing/test.proto
index 9faba297a3..84369db4b8 100644
--- a/src/proto/grpc/testing/test.proto
+++ b/src/proto/grpc/testing/test.proto
@@ -1,5 +1,5 @@
-// Copyright 2015, Google Inc.
+// Copyright 2015-2016, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
@@ -80,6 +80,6 @@ service UnimplementedService {
// A service used to control reconnect server.
service ReconnectService {
- rpc Start(grpc.testing.Empty) returns (grpc.testing.Empty);
+ rpc Start(grpc.testing.ReconnectParams) returns (grpc.testing.Empty);
rpc Stop(grpc.testing.Empty) returns (grpc.testing.ReconnectInfo);
}
diff --git a/src/python/grpcio/grpc/beta/implementations.py b/src/python/grpcio/grpc/beta/implementations.py
index 06ee7aa26e..742e94dc65 100644
--- a/src/python/grpcio/grpc/beta/implementations.py
+++ b/src/python/grpcio/grpc/beta/implementations.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index 875ff49d30..2ed0b1e520 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -83,6 +83,23 @@ CORE_SOURCE_FILES = [
'src/core/ext/census/operation.c',
'src/core/ext/census/placeholders.c',
'src/core/ext/census/tracing.c',
+ 'src/core/ext/client_config/channel_connectivity.c',
+ 'src/core/ext/client_config/client_channel.c',
+ 'src/core/ext/client_config/client_channel_factory.c',
+ 'src/core/ext/client_config/client_config.c',
+ 'src/core/ext/client_config/connector.c',
+ 'src/core/ext/client_config/default_initial_connect_string.c',
+ 'src/core/ext/client_config/initial_connect_string.c',
+ 'src/core/ext/client_config/lb_policy.c',
+ 'src/core/ext/client_config/lb_policy_factory.c',
+ 'src/core/ext/client_config/lb_policy_registry.c',
+ 'src/core/ext/client_config/resolver.c',
+ 'src/core/ext/client_config/resolver_factory.c',
+ 'src/core/ext/client_config/resolver_registry.c',
+ 'src/core/ext/client_config/subchannel.c',
+ 'src/core/ext/client_config/subchannel_call_holder.c',
+ 'src/core/ext/client_config/subchannel_index.c',
+ 'src/core/ext/client_config/uri_parser.c',
'src/core/ext/lb_policy/grpclb/load_balancer_api.c',
'src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c',
'src/core/ext/lb_policy/pick_first/pick_first.c',
@@ -117,26 +134,10 @@ CORE_SOURCE_FILES = [
'src/core/lib/channel/channel_args.c',
'src/core/lib/channel/channel_stack.c',
'src/core/lib/channel/channel_stack_builder.c',
- 'src/core/lib/channel/client_channel.c',
'src/core/lib/channel/compress_filter.c',
'src/core/lib/channel/connected_channel.c',
'src/core/lib/channel/http_client_filter.c',
'src/core/lib/channel/http_server_filter.c',
- 'src/core/lib/channel/subchannel_call_holder.c',
- 'src/core/lib/client_config/client_config.c',
- 'src/core/lib/client_config/connector.c',
- 'src/core/lib/client_config/default_initial_connect_string.c',
- 'src/core/lib/client_config/initial_connect_string.c',
- 'src/core/lib/client_config/lb_policy.c',
- 'src/core/lib/client_config/lb_policy_factory.c',
- 'src/core/lib/client_config/lb_policy_registry.c',
- 'src/core/lib/client_config/resolver.c',
- 'src/core/lib/client_config/resolver_factory.c',
- 'src/core/lib/client_config/resolver_registry.c',
- 'src/core/lib/client_config/subchannel.c',
- 'src/core/lib/client_config/subchannel_factory.c',
- 'src/core/lib/client_config/subchannel_index.c',
- 'src/core/lib/client_config/uri_parser.c',
'src/core/lib/compression/compression_algorithm.c',
'src/core/lib/compression/message_compress.c',
'src/core/lib/debug/trace.c',
@@ -209,7 +210,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/surface/call_details.c',
'src/core/lib/surface/call_log_batch.c',
'src/core/lib/surface/channel.c',
- 'src/core/lib/surface/channel_connectivity.c',
'src/core/lib/surface/channel_init.c',
'src/core/lib/surface/channel_ping.c',
'src/core/lib/surface/channel_stack_type.c',
diff --git a/src/python/grpcio/tests/interop/_secure_interop_test.py b/src/python/grpcio/tests/interop/_secure_interop_test.py
index 1a1a063a6f..86d7e43351 100644
--- a/src/python/grpcio/tests/interop/_secure_interop_test.py
+++ b/src/python/grpcio/tests/interop/_secure_interop_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/src/python/grpcio/tests/interop/client.py b/src/python/grpcio/tests/interop/client.py
index 02a37cc6bc..1d10d7e45d 100644
--- a/src/python/grpcio/tests/interop/client.py
+++ b/src/python/grpcio/tests/interop/client.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/src/python/grpcio/tests/unit/beta/_beta_features_test.py b/src/python/grpcio/tests/unit/beta/_beta_features_test.py
index b8b77a96c1..bb2893a21b 100644
--- a/src/python/grpcio/tests/unit/beta/_beta_features_test.py
+++ b/src/python/grpcio/tests/unit/beta/_beta_features_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/src/python/grpcio/tests/unit/beta/_face_interface_test.py b/src/python/grpcio/tests/unit/beta/_face_interface_test.py
index ea19ee47ae..3a67516906 100644
--- a/src/python/grpcio/tests/unit/beta/_face_interface_test.py
+++ b/src/python/grpcio/tests/unit/beta/_face_interface_test.py
@@ -1,4 +1,4 @@
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/src/ruby/ext/grpc/rb_call.c b/src/ruby/ext/grpc/rb_call.c
index dc80d18b45..f5fdbb2ffd 100644
--- a/src/ruby/ext/grpc/rb_call.c
+++ b/src/ruby/ext/grpc/rb_call.c
@@ -359,7 +359,7 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
md_ary->metadata[md_ary->count].value_length = value_len;
md_ary->count += 1;
}
- } else {
+ } else if (TYPE(val) == T_STRING) {
value_str = RSTRING_PTR(val);
value_len = RSTRING_LEN(val);
if (!grpc_is_binary_header(key_str, key_len) &&
@@ -373,6 +373,10 @@ static int grpc_rb_md_ary_fill_hash_cb(VALUE key, VALUE val, VALUE md_ary_obj) {
md_ary->metadata[md_ary->count].value = value_str;
md_ary->metadata[md_ary->count].value_length = value_len;
md_ary->count += 1;
+ } else {
+ rb_raise(rb_eArgError,
+ "Header values must be of type string or array");
+ return ST_STOP;
}
return ST_CONTINUE;
diff --git a/src/ruby/lib/grpc/generic/rpc_server.rb b/src/ruby/lib/grpc/generic/rpc_server.rb
index 4b5578b018..5ba77db173 100644
--- a/src/ruby/lib/grpc/generic/rpc_server.rb
+++ b/src/ruby/lib/grpc/generic/rpc_server.rb
@@ -403,7 +403,7 @@ module GRPC
loop_handle_server_calls
end
- # Sends UNAVAILABLE if there are too many unprocessed jobs
+ # Sends RESOURCE_EXHAUSTED if there are too many unprocessed jobs
def available?(an_rpc)
jobs_count, max = @pool.jobs_waiting, @max_waiting_requests
GRPC.logger.info("waiting: #{jobs_count}, max: #{max}")
@@ -411,7 +411,7 @@ module GRPC
GRPC.logger.warn("NOT AVAILABLE: too many jobs_waiting: #{an_rpc}")
noop = proc { |x| x }
c = ActiveCall.new(an_rpc.call, @cq, noop, noop, an_rpc.deadline)
- c.send_status(StatusCodes::UNAVAILABLE, '')
+ c.send_status(StatusCodes::RESOURCE_EXHAUSTED, '')
nil
end
diff --git a/src/ruby/spec/generic/client_stub_spec.rb b/src/ruby/spec/generic/client_stub_spec.rb
index 5e13c25fcf..dd8e2e9f7a 100644
--- a/src/ruby/spec/generic/client_stub_spec.rb
+++ b/src/ruby/spec/generic/client_stub_spec.rb
@@ -193,44 +193,45 @@ describe 'ClientStub' do
describe '#client_streamer' do
shared_examples 'client streaming' do
before(:each) do
+ server_port = create_test_server
+ host = "localhost:#{server_port}"
+ @stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure)
+ @options = { k1: 'v1', k2: 'v2' }
@sent_msgs = Array.new(3) { |i| 'msg_' + (i + 1).to_s }
@resp = 'a_reply'
end
it 'should send requests to/receive a reply from a server' do
- server_port = create_test_server
- host = "localhost:#{server_port}"
th = run_client_streamer(@sent_msgs, @resp, @pass)
- stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure)
- expect(get_response(stub)).to eq(@resp)
+ expect(get_response(@stub)).to eq(@resp)
th.join
end
it 'should send metadata to the server ok' do
- server_port = create_test_server
- host = "localhost:#{server_port}"
- th = run_client_streamer(@sent_msgs, @resp, @pass,
- k1: 'v1', k2: 'v2')
- stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure)
- expect(get_response(stub)).to eq(@resp)
+ th = run_client_streamer(@sent_msgs, @resp, @pass, @options)
+ expect(get_response(@stub)).to eq(@resp)
th.join
end
it 'should raise an error if the status is not ok' do
- server_port = create_test_server
- host = "localhost:#{server_port}"
th = run_client_streamer(@sent_msgs, @resp, @fail)
- stub = GRPC::ClientStub.new(host, @cq, :this_channel_is_insecure)
- blk = proc { get_response(stub) }
+ blk = proc { get_response(@stub) }
expect(&blk).to raise_error(GRPC::BadStatus)
th.join
end
+
+ it 'should raise ArgumentError if metadata contains invalid values' do
+ @options.merge!(k3: 3)
+ expect do
+ get_response(@stub)
+ end.to raise_error(ArgumentError,
+ /Header values must be of type string or array/)
+ end
end
describe 'without a call operation' do
def get_response(stub)
- stub.client_streamer(@method, @sent_msgs, noop, noop,
- k1: 'v1', k2: 'v2')
+ stub.client_streamer(@method, @sent_msgs, noop, noop, @options)
end
it_behaves_like 'client streaming'
@@ -239,7 +240,7 @@ describe 'ClientStub' do
describe 'via a call operation' do
def get_response(stub)
op = stub.client_streamer(@method, @sent_msgs, noop, noop,
- return_op: true, k1: 'v1', k2: 'v2')
+ @options.merge(return_op: true))
expect(op).to be_a(GRPC::ActiveCall::Operation)
op.execute
end
diff --git a/src/ruby/spec/generic/rpc_server_spec.rb b/src/ruby/spec/generic/rpc_server_spec.rb
index e16ba60387..e688057cb1 100644
--- a/src/ruby/spec/generic/rpc_server_spec.rb
+++ b/src/ruby/spec/generic/rpc_server_spec.rb
@@ -426,7 +426,7 @@ describe GRPC::RpcServer do
threads.each(&:join)
end
- it 'should return UNAVAILABLE on too many jobs', server: true do
+ it 'should return RESOURCE_EXHAUSTED on too many jobs', server: true do
opts = {
a_channel_arg: 'an_arg',
server_override: @server,
@@ -449,7 +449,8 @@ describe GRPC::RpcServer do
begin
stub.an_rpc(req)
rescue GRPC::BadStatus => e
- one_failed_as_unavailable = e.code == StatusCodes::UNAVAILABLE
+ one_failed_as_unavailable =
+ e.code == StatusCodes::RESOURCE_EXHAUSTED
end
end
end
diff --git a/test/core/bad_ssl/bad_ssl_test.c b/test/core/bad_ssl/bad_ssl_test.c
index 12c7710af6..c4ae212ec2 100644
--- a/test/core/bad_ssl/bad_ssl_test.c
+++ b/test/core/bad_ssl/bad_ssl_test.c
@@ -87,7 +87,7 @@ static void run_test(const char *target, size_t nops) {
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
- op->flags = 0;
+ op->flags = GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY;
op->reserved = NULL;
op++;
op->op = GRPC_OP_RECV_STATUS_ON_CLIENT;
diff --git a/test/core/client_config/lb_policies_test.c b/test/core/client_config/lb_policies_test.c
index b819f2bc60..e766672cf5 100644
--- a/test/core/client_config/lb_policies_test.c
+++ b/test/core/client_config/lb_policies_test.c
@@ -41,9 +41,9 @@
#include <grpc/support/string_util.h>
#include <grpc/support/time.h>
+#include "src/core/ext/client_config/client_channel.h"
+#include "src/core/ext/client_config/lb_policy_registry.h"
#include "src/core/lib/channel/channel_stack.h"
-#include "src/core/lib/channel/client_channel.h"
-#include "src/core/lib/client_config/lb_policy_registry.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/surface/channel.h"
#include "src/core/lib/surface/server.h"
diff --git a/test/core/client_config/resolvers/dns_resolver_connectivity_test.c b/test/core/client_config/resolvers/dns_resolver_connectivity_test.c
index b7c3b78fe1..2322aa688a 100644
--- a/test/core/client_config/resolvers/dns_resolver_connectivity_test.c
+++ b/test/core/client_config/resolvers/dns_resolver_connectivity_test.c
@@ -36,25 +36,33 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/timer.h"
#include "test/core/util/test_config.h"
-static void subchannel_factory_ref(grpc_subchannel_factory *scv) {}
-static void subchannel_factory_unref(grpc_exec_ctx *exec_ctx,
- grpc_subchannel_factory *scv) {}
-static grpc_subchannel *subchannel_factory_create_subchannel(
- grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *factory,
+static void client_channel_factory_ref(grpc_client_channel_factory *scv) {}
+static void client_channel_factory_unref(grpc_exec_ctx *exec_ctx,
+ grpc_client_channel_factory *scv) {}
+static grpc_subchannel *client_channel_factory_create_subchannel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *factory,
grpc_subchannel_args *args) {
return NULL;
}
-static const grpc_subchannel_factory_vtable sc_vtable = {
- subchannel_factory_ref, subchannel_factory_unref,
- subchannel_factory_create_subchannel};
+static grpc_channel *client_channel_factory_create_channel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
+ const char *target, grpc_client_channel_type type,
+ grpc_channel_args *args) {
+ GPR_UNREACHABLE_CODE(return NULL);
+}
+
+static const grpc_client_channel_factory_vtable sc_vtable = {
+ client_channel_factory_ref, client_channel_factory_unref,
+ client_channel_factory_create_subchannel,
+ client_channel_factory_create_channel};
-static grpc_subchannel_factory sc_factory = {&sc_vtable};
+static grpc_client_channel_factory cc_factory = {&sc_vtable};
static gpr_mu g_mu;
static bool g_fail_resolution = true;
@@ -84,7 +92,7 @@ static grpc_resolver *create_resolver(const char *name) {
grpc_resolver_args args;
memset(&args, 0, sizeof(args));
args.uri = uri;
- args.subchannel_factory = &sc_factory;
+ args.client_channel_factory = &cc_factory;
grpc_resolver *resolver =
grpc_resolver_factory_create_resolver(factory, &args);
grpc_resolver_factory_unref(factory);
diff --git a/test/core/client_config/resolvers/dns_resolver_test.c b/test/core/client_config/resolvers/dns_resolver_test.c
index 0e8a3b13dd..21dc99cadd 100644
--- a/test/core/client_config/resolvers/dns_resolver_test.c
+++ b/test/core/client_config/resolvers/dns_resolver_test.c
@@ -35,23 +35,31 @@
#include <grpc/support/log.h>
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "test/core/util/test_config.h"
-static void subchannel_factory_ref(grpc_subchannel_factory *scv) {}
-static void subchannel_factory_unref(grpc_exec_ctx *exec_ctx,
- grpc_subchannel_factory *scv) {}
-static grpc_subchannel *subchannel_factory_create_subchannel(
- grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *factory,
+static void client_channel_factory_ref(grpc_client_channel_factory *scv) {}
+static void client_channel_factory_unref(grpc_exec_ctx *exec_ctx,
+ grpc_client_channel_factory *scv) {}
+static grpc_subchannel *client_channel_factory_create_subchannel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *factory,
grpc_subchannel_args *args) {
GPR_UNREACHABLE_CODE(return NULL);
}
-static const grpc_subchannel_factory_vtable sc_vtable = {
- subchannel_factory_ref, subchannel_factory_unref,
- subchannel_factory_create_subchannel};
+static grpc_channel *client_channel_factory_create_channel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
+ const char *target, grpc_client_channel_type type,
+ grpc_channel_args *args) {
+ GPR_UNREACHABLE_CODE(return NULL);
+}
+
+static const grpc_client_channel_factory_vtable sc_vtable = {
+ client_channel_factory_ref, client_channel_factory_unref,
+ client_channel_factory_create_subchannel,
+ client_channel_factory_create_channel};
-static grpc_subchannel_factory sc_factory = {&sc_vtable};
+static grpc_client_channel_factory cc_factory = {&sc_vtable};
static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@@ -63,7 +71,7 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
GPR_ASSERT(uri);
memset(&args, 0, sizeof(args));
args.uri = uri;
- args.subchannel_factory = &sc_factory;
+ args.client_channel_factory = &cc_factory;
resolver = grpc_resolver_factory_create_resolver(factory, &args);
GPR_ASSERT(resolver != NULL);
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_succeeds");
diff --git a/test/core/client_config/resolvers/sockaddr_resolver_test.c b/test/core/client_config/resolvers/sockaddr_resolver_test.c
index b2c4c63b79..b11546b6b1 100644
--- a/test/core/client_config/resolvers/sockaddr_resolver_test.c
+++ b/test/core/client_config/resolvers/sockaddr_resolver_test.c
@@ -35,23 +35,31 @@
#include <grpc/support/log.h>
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "test/core/util/test_config.h"
-static void subchannel_factory_ref(grpc_subchannel_factory *scv) {}
-static void subchannel_factory_unref(grpc_exec_ctx *exec_ctx,
- grpc_subchannel_factory *scv) {}
-static grpc_subchannel *subchannel_factory_create_subchannel(
- grpc_exec_ctx *exec_ctx, grpc_subchannel_factory *factory,
+static void client_channel_factory_ref(grpc_client_channel_factory *scv) {}
+static void client_channel_factory_unref(grpc_exec_ctx *exec_ctx,
+ grpc_client_channel_factory *scv) {}
+static grpc_subchannel *client_channel_factory_create_subchannel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *factory,
grpc_subchannel_args *args) {
GPR_UNREACHABLE_CODE(return NULL);
}
-static const grpc_subchannel_factory_vtable sc_vtable = {
- subchannel_factory_ref, subchannel_factory_unref,
- subchannel_factory_create_subchannel};
+static grpc_channel *client_channel_factory_create_channel(
+ grpc_exec_ctx *exec_ctx, grpc_client_channel_factory *cc_factory,
+ const char *target, grpc_client_channel_type type,
+ grpc_channel_args *args) {
+ GPR_UNREACHABLE_CODE(return NULL);
+}
+
+static const grpc_client_channel_factory_vtable sc_vtable = {
+ client_channel_factory_ref, client_channel_factory_unref,
+ client_channel_factory_create_subchannel,
+ client_channel_factory_create_channel};
-static grpc_subchannel_factory sc_factory = {&sc_vtable};
+static grpc_client_channel_factory cc_factory = {&sc_vtable};
static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@@ -63,7 +71,7 @@ static void test_succeeds(grpc_resolver_factory *factory, const char *string) {
GPR_ASSERT(uri);
memset(&args, 0, sizeof(args));
args.uri = uri;
- args.subchannel_factory = &sc_factory;
+ args.client_channel_factory = &cc_factory;
resolver = grpc_resolver_factory_create_resolver(factory, &args);
GPR_ASSERT(resolver != NULL);
GRPC_RESOLVER_UNREF(&exec_ctx, resolver, "test_succeeds");
diff --git a/test/core/client_config/set_initial_connect_string_test.c b/test/core/client_config/set_initial_connect_string_test.c
index 3ca037355c..83058d9b2c 100644
--- a/test/core/client_config/set_initial_connect_string_test.c
+++ b/test/core/client_config/set_initial_connect_string_test.c
@@ -38,7 +38,7 @@
#include <grpc/support/log.h>
#include <grpc/support/slice.h>
-#include "src/core/lib/client_config/initial_connect_string.h"
+#include "src/core/ext/client_config/initial_connect_string.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/security/credentials.h"
#include "src/core/lib/support/string.h"
diff --git a/test/core/client_config/uri_fuzzer_test.c b/test/core/client_config/uri_fuzzer_test.c
index d50a05db20..eb976fc9f5 100644
--- a/test/core/client_config/uri_fuzzer_test.c
+++ b/test/core/client_config/uri_fuzzer_test.c
@@ -36,7 +36,7 @@
#include <grpc/support/alloc.h>
-#include "src/core/lib/client_config/uri_parser.h"
+#include "src/core/ext/client_config/uri_parser.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char *s = gpr_malloc(size + 1);
diff --git a/test/core/client_config/uri_parser_test.c b/test/core/client_config/uri_parser_test.c
index f87aa81ee6..323e8b6f70 100644
--- a/test/core/client_config/uri_parser_test.c
+++ b/test/core/client_config/uri_parser_test.c
@@ -31,7 +31,7 @@
*
*/
-#include "src/core/lib/client_config/uri_parser.h"
+#include "src/core/ext/client_config/uri_parser.h"
#include <string.h>
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c
index 8568bb1a86..81f76ea79c 100644
--- a/test/core/end2end/dualstack_socket_test.c
+++ b/test/core/end2end/dualstack_socket_test.c
@@ -168,7 +168,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
- op->flags = 0;
+ op->flags = expect_ok ? GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY : 0;
op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
@@ -237,7 +237,7 @@ void test_connect(const char *server_host, const char *client_host, int port,
cq_expect_completion(cqv, tag(1), 1);
cq_verify(cqv);
- GPR_ASSERT(status == GRPC_STATUS_DEADLINE_EXCEEDED);
+ GPR_ASSERT(status == GRPC_STATUS_UNAVAILABLE);
}
grpc_call_destroy(c);
diff --git a/test/core/end2end/fixtures/h2_census.c b/test/core/end2end/fixtures/h2_census.c
index 9b6f2bf80d..ff2f028f09 100644
--- a/test/core/end2end/fixtures/h2_census.c
+++ b/test/core/end2end/fixtures/h2_census.c
@@ -41,9 +41,9 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/surface/channel.h"
diff --git a/test/core/end2end/fixtures/h2_compress.c b/test/core/end2end/fixtures/h2_compress.c
index fe72c6851f..8f9b7c9cd9 100644
--- a/test/core/end2end/fixtures/h2_compress.c
+++ b/test/core/end2end/fixtures/h2_compress.c
@@ -41,9 +41,9 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
#include "src/core/lib/channel/channel_args.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/surface/channel.h"
diff --git a/test/core/end2end/fixtures/h2_full+pipe.c b/test/core/end2end/fixtures/h2_full+pipe.c
index 11e6d0eff2..e7dfc561a1 100644
--- a/test/core/end2end/fixtures/h2_full+pipe.c
+++ b/test/core/end2end/fixtures/h2_full+pipe.c
@@ -41,8 +41,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/iomgr/wakeup_fd_posix.h"
diff --git a/test/core/end2end/fixtures/h2_full+trace.c b/test/core/end2end/fixtures/h2_full+trace.c
index 7599412dfb..c4dc5b9bc1 100644
--- a/test/core/end2end/fixtures/h2_full+trace.c
+++ b/test/core/end2end/fixtures/h2_full+trace.c
@@ -41,8 +41,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/support/env.h"
diff --git a/test/core/end2end/fixtures/h2_full.c b/test/core/end2end/fixtures/h2_full.c
index d4ee2aeb9d..4a2f17eb91 100644
--- a/test/core/end2end/fixtures/h2_full.c
+++ b/test/core/end2end/fixtures/h2_full.c
@@ -41,8 +41,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/surface/channel.h"
diff --git a/test/core/end2end/fixtures/h2_proxy.c b/test/core/end2end/fixtures/h2_proxy.c
index 8f6f156ef7..863673a4e0 100644
--- a/test/core/end2end/fixtures/h2_proxy.c
+++ b/test/core/end2end/fixtures/h2_proxy.c
@@ -41,8 +41,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/surface/channel.h"
diff --git a/test/core/end2end/fixtures/h2_sockpair+trace.c b/test/core/end2end/fixtures/h2_sockpair+trace.c
index 4eb1c57302..87533a9b7f 100644
--- a/test/core/end2end/fixtures/h2_sockpair+trace.c
+++ b/test/core/end2end/fixtures/h2_sockpair+trace.c
@@ -40,8 +40,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/compress_filter.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_client_filter.h"
diff --git a/test/core/end2end/fixtures/h2_sockpair.c b/test/core/end2end/fixtures/h2_sockpair.c
index 7760d38100..f28147cf40 100644
--- a/test/core/end2end/fixtures/h2_sockpair.c
+++ b/test/core/end2end/fixtures/h2_sockpair.c
@@ -40,8 +40,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/compress_filter.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_client_filter.h"
diff --git a/test/core/end2end/fixtures/h2_sockpair_1byte.c b/test/core/end2end/fixtures/h2_sockpair_1byte.c
index 23a5a19c59..302b16b372 100644
--- a/test/core/end2end/fixtures/h2_sockpair_1byte.c
+++ b/test/core/end2end/fixtures/h2_sockpair_1byte.c
@@ -40,8 +40,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/compress_filter.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_client_filter.h"
diff --git a/test/core/end2end/fixtures/h2_uds.c b/test/core/end2end/fixtures/h2_uds.c
index d454a103ce..cffbeaf045 100644
--- a/test/core/end2end/fixtures/h2_uds.c
+++ b/test/core/end2end/fixtures/h2_uds.c
@@ -44,8 +44,8 @@
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/useful.h>
+#include "src/core/ext/client_config/client_channel.h"
#include "src/core/ext/transport/chttp2/transport/chttp2_transport.h"
-#include "src/core/lib/channel/client_channel.h"
#include "src/core/lib/channel/connected_channel.h"
#include "src/core/lib/channel/http_server_filter.h"
#include "src/core/lib/support/string.h"
diff --git a/test/core/end2end/fixtures/proxy.c b/test/core/end2end/fixtures/proxy.c
index 1ca53cdad9..a6487a17ac 100644
--- a/test/core/end2end/fixtures/proxy.c
+++ b/test/core/end2end/fixtures/proxy.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/end2end/tests/idempotent_request.c b/test/core/end2end/tests/idempotent_request.c
index 42a672bf19..e53f3b2aaa 100644
--- a/test/core/end2end/tests/idempotent_request.c
+++ b/test/core/end2end/tests/idempotent_request.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/end2end/tests/simple_delayed_request.c b/test/core/end2end/tests/simple_delayed_request.c
index 013f1e3981..400b3a0027 100644
--- a/test/core/end2end/tests/simple_delayed_request.c
+++ b/test/core/end2end/tests/simple_delayed_request.c
@@ -120,7 +120,7 @@ static void simple_delayed_request_body(grpc_end2end_test_config config,
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
- op->flags = 0;
+ op->flags = GRPC_INITIAL_METADATA_IGNORE_CONNECTIVITY;
op->reserved = NULL;
op++;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
diff --git a/test/core/internal_api_canaries/iomgr.c b/test/core/internal_api_canaries/iomgr.c
index 04d66994cd..f87a80cd90 100644
--- a/test/core/internal_api_canaries/iomgr.c
+++ b/test/core/internal_api_canaries/iomgr.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/internal_api_canaries/support.c b/test/core/internal_api_canaries/support.c
index 7e00e0d2ff..c51cbf2522 100644
--- a/test/core/internal_api_canaries/support.c
+++ b/test/core/internal_api_canaries/support.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/internal_api_canaries/transport.c b/test/core/internal_api_canaries/transport.c
index 01daabaa56..0617865412 100644
--- a/test/core/internal_api_canaries/transport.c
+++ b/test/core/internal_api_canaries/transport.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/surface/channel_create_test.c b/test/core/surface/channel_create_test.c
index 95b4eaf093..5ff66bd7a5 100644
--- a/test/core/surface/channel_create_test.c
+++ b/test/core/surface/channel_create_test.c
@@ -33,7 +33,7 @@
#include <grpc/grpc.h>
#include <grpc/support/log.h>
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "test/core/util/test_config.h"
void test_unknown_scheme_target(void) {
diff --git a/test/core/surface/secure_channel_create_test.c b/test/core/surface/secure_channel_create_test.c
index eb710cba38..80419efce4 100644
--- a/test/core/surface/secure_channel_create_test.c
+++ b/test/core/surface/secure_channel_create_test.c
@@ -36,7 +36,7 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
#include <grpc/support/log.h>
-#include "src/core/lib/client_config/resolver_registry.h"
+#include "src/core/ext/client_config/resolver_registry.h"
#include "src/core/lib/security/credentials.h"
#include "src/core/lib/security/security_connector.h"
#include "src/core/lib/surface/channel.h"
diff --git a/test/core/surface/server_test.c b/test/core/surface/server_test.c
index 7bb45434f4..3d2e25379a 100644
--- a/test/core/surface/server_test.c
+++ b/test/core/surface/server_test.c
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015-2016, Google Inc.
+ * Copyright 2015, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
diff --git a/test/core/util/reconnect_server.c b/test/core/util/reconnect_server.c
index 5b0b3259c8..d408374a09 100644
--- a/test/core/util/reconnect_server.c
+++ b/test/core/util/reconnect_server.c
@@ -60,8 +60,12 @@ static void pretty_print_backoffs(reconnect_server *server) {
i, backoff / 1000.0, expected_backoff / 1000.0,
(backoff - expected_backoff) * 100.0 / expected_backoff);
expected_backoff *= 1.6;
- if (expected_backoff > 120 * 1000) {
- expected_backoff = 120 * 1000;
+ int max_reconnect_backoff_ms = 120 * 1000;
+ if (server->max_reconnect_backoff_ms > 0) {
+ max_reconnect_backoff_ms = server->max_reconnect_backoff_ms;
+ }
+ if (expected_backoff > max_reconnect_backoff_ms) {
+ expected_backoff = max_reconnect_backoff_ms;
}
}
}
@@ -108,6 +112,7 @@ void reconnect_server_init(reconnect_server *server) {
server->head = NULL;
server->tail = NULL;
server->peer = NULL;
+ server->max_reconnect_backoff_ms = 0;
}
void reconnect_server_start(reconnect_server *server, int port) {
diff --git a/test/core/util/reconnect_server.h b/test/core/util/reconnect_server.h
index e2e6a02461..ed02d49512 100644
--- a/test/core/util/reconnect_server.h
+++ b/test/core/util/reconnect_server.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,6 +52,7 @@ typedef struct reconnect_server {
timestamp_list *head;
timestamp_list *tail;
char *peer;
+ int max_reconnect_backoff_ms;
} reconnect_server;
void reconnect_server_init(reconnect_server *server);
diff --git a/test/cpp/end2end/client_crash_test.cc b/test/cpp/end2end/client_crash_test.cc
index c01f40dbc2..30b04fb9b9 100644
--- a/test/cpp/end2end/client_crash_test.cc
+++ b/test/cpp/end2end/client_crash_test.cc
@@ -88,6 +88,7 @@ TEST_F(CrashTest, KillBeforeWrite) {
EchoRequest request;
EchoResponse response;
ClientContext context;
+ context.set_fail_fast(false);
auto stream = stub->BidiStream(&context);
@@ -113,6 +114,7 @@ TEST_F(CrashTest, KillAfterWrite) {
EchoRequest request;
EchoResponse response;
ClientContext context;
+ context.set_fail_fast(false);
auto stream = stub->BidiStream(&context);
diff --git a/test/cpp/end2end/server_crash_test_client.cc b/test/cpp/end2end/server_crash_test_client.cc
index 1964840fa5..ece948d5a7 100644
--- a/test/cpp/end2end/server_crash_test_client.cc
+++ b/test/cpp/end2end/server_crash_test_client.cc
@@ -63,6 +63,7 @@ int main(int argc, char** argv) {
EchoRequest request;
EchoResponse response;
grpc::ClientContext context;
+ context.set_fail_fast(false);
if (FLAGS_mode == "bidi") {
auto stream = stub->BidiStream(&context);
diff --git a/test/cpp/interop/reconnect_interop_client.cc b/test/cpp/interop/reconnect_interop_client.cc
index 87e3bd6c76..797e52c744 100644
--- a/test/cpp/interop/reconnect_interop_client.cc
+++ b/test/cpp/interop/reconnect_interop_client.cc
@@ -37,6 +37,7 @@
#include <gflags/gflags.h>
#include <grpc++/channel.h>
#include <grpc++/client_context.h>
+#include <grpc++/support/channel_arguments.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
#include "src/proto/grpc/testing/empty.grpc.pb.h"
@@ -48,13 +49,18 @@
DEFINE_int32(server_control_port, 0, "Server port for control rpcs.");
DEFINE_int32(server_retry_port, 0, "Server port for testing reconnection.");
DEFINE_string(server_host, "127.0.0.1", "Server host to connect to");
+DEFINE_int32(max_reconnect_backoff_ms, 0,
+ "Maximum backoff time, or 0 for default.");
+using grpc::CallCredentials;
using grpc::Channel;
+using grpc::ChannelArguments;
using grpc::ClientContext;
using grpc::CreateTestChannel;
using grpc::Status;
using grpc::testing::Empty;
using grpc::testing::ReconnectInfo;
+using grpc::testing::ReconnectParams;
using grpc::testing::ReconnectService;
int main(int argc, char** argv) {
@@ -68,17 +74,25 @@ int main(int argc, char** argv) {
ReconnectService::NewStub(
CreateTestChannel(server_address.str(), false)));
ClientContext start_context;
- Empty empty_request;
+ ReconnectParams reconnect_params;
+ reconnect_params.set_max_reconnect_backoff_ms(FLAGS_max_reconnect_backoff_ms);
Empty empty_response;
Status start_status =
- control_stub->Start(&start_context, empty_request, &empty_response);
+ control_stub->Start(&start_context, reconnect_params, &empty_response);
GPR_ASSERT(start_status.ok());
gpr_log(GPR_INFO, "Starting connections with retries.");
server_address.str("");
server_address << FLAGS_server_host << ':' << FLAGS_server_retry_port;
+ ChannelArguments channel_args;
+ if (FLAGS_max_reconnect_backoff_ms > 0) {
+ channel_args.SetInt(GRPC_ARG_MAX_RECONNECT_BACKOFF_MS,
+ FLAGS_max_reconnect_backoff_ms);
+ }
std::shared_ptr<Channel> retry_channel =
- CreateTestChannel(server_address.str(), true);
+ CreateTestChannel(server_address.str(), "foo.test.google.fr", true, false,
+ std::shared_ptr<CallCredentials>(), channel_args);
+
// About 13 retries.
const int kDeadlineSeconds = 540;
// Use any rpc to test retry.
@@ -88,15 +102,15 @@ int main(int argc, char** argv) {
retry_context.set_deadline(std::chrono::system_clock::now() +
std::chrono::seconds(kDeadlineSeconds));
Status retry_status =
- retry_stub->Start(&retry_context, empty_request, &empty_response);
+ retry_stub->Start(&retry_context, reconnect_params, &empty_response);
GPR_ASSERT(retry_status.error_code() == grpc::StatusCode::DEADLINE_EXCEEDED);
gpr_log(GPR_INFO, "Done retrying, getting final data from server");
ClientContext stop_context;
ReconnectInfo response;
- Status stop_status =
- control_stub->Stop(&stop_context, empty_request, &response);
+ Status stop_status = control_stub->Stop(&stop_context, Empty(), &response);
GPR_ASSERT(stop_status.ok());
GPR_ASSERT(response.passed() == true);
+ gpr_log(GPR_INFO, "Passed");
return 0;
}
diff --git a/test/cpp/interop/reconnect_interop_server.cc b/test/cpp/interop/reconnect_interop_server.cc
index e2114fae19..53d51e80e7 100644
--- a/test/cpp/interop/reconnect_interop_server.cc
+++ b/test/cpp/interop/reconnect_interop_server.cc
@@ -71,6 +71,7 @@ using grpc::Status;
using grpc::testing::Empty;
using grpc::testing::ReconnectService;
using grpc::testing::ReconnectInfo;
+using grpc::testing::ReconnectParams;
static bool got_sigint = false;
@@ -92,7 +93,8 @@ class ReconnectServiceImpl : public ReconnectService::Service {
void Poll(int seconds) { reconnect_server_poll(&tcp_server_, seconds); }
- Status Start(ServerContext* context, const Empty* request, Empty* response) {
+ Status Start(ServerContext* context, const ReconnectParams* request,
+ Empty* response) {
bool start_server = true;
std::unique_lock<std::mutex> lock(mu_);
while (serving_ && !shutdown_) {
@@ -105,6 +107,8 @@ class ReconnectServiceImpl : public ReconnectService::Service {
if (server_started_) {
start_server = false;
} else {
+ tcp_server_.max_reconnect_backoff_ms =
+ request->max_reconnect_backoff_ms();
server_started_ = true;
}
lock.unlock();
@@ -133,7 +137,9 @@ class ReconnectServiceImpl : public ReconnectService::Service {
const double kTransmissionDelay = 100.0;
const double kBackoffMultiplier = 1.6;
const double kJitterFactor = 0.2;
- const int kMaxBackoffMs = 120 * 1000;
+ const int kMaxBackoffMs = tcp_server_.max_reconnect_backoff_ms
+ ? tcp_server_.max_reconnect_backoff_ms
+ : 120 * 1000;
bool passed = true;
for (timestamp_list* cur = tcp_server_.head; cur && cur->next;
cur = cur->next) {
diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc
index 0cd9f9e767..fe8b5d5423 100644
--- a/test/cpp/util/create_test_channel.cc
+++ b/test/cpp/util/create_test_channel.cc
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -58,8 +58,9 @@ namespace grpc {
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
bool enable_ssl, bool use_prod_roots,
- const std::shared_ptr<CallCredentials>& creds) {
- ChannelArguments channel_args;
+ const std::shared_ptr<CallCredentials>& creds,
+ const ChannelArguments& args) {
+ ChannelArguments channel_args(args);
if (enable_ssl) {
const char* roots_certs = use_prod_roots ? "" : test_root_cert;
SslCredentialsOptions ssl_opts = {roots_certs, "", ""};
@@ -83,6 +84,14 @@ std::shared_ptr<Channel> CreateTestChannel(
std::shared_ptr<Channel> CreateTestChannel(
const grpc::string& server, const grpc::string& override_hostname,
+ bool enable_ssl, bool use_prod_roots,
+ const std::shared_ptr<CallCredentials>& creds) {
+ return CreateTestChannel(server, override_hostname, enable_ssl,
+ use_prod_roots, creds, ChannelArguments());
+}
+
+std::shared_ptr<Channel> CreateTestChannel(
+ const grpc::string& server, const grpc::string& override_hostname,
bool enable_ssl, bool use_prod_roots) {
return CreateTestChannel(server, override_hostname, enable_ssl,
use_prod_roots, std::shared_ptr<CallCredentials>());
diff --git a/test/cpp/util/create_test_channel.h b/test/cpp/util/create_test_channel.h
index b50d653de3..4ff666dc1b 100644
--- a/test/cpp/util/create_test_channel.h
+++ b/test/cpp/util/create_test_channel.h
@@ -1,6 +1,6 @@
/*
*
- * Copyright 2015, Google Inc.
+ * Copyright 2015-2016, Google Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,12 @@ std::shared_ptr<Channel> CreateTestChannel(
bool enable_ssl, bool use_prod_roots,
const std::shared_ptr<CallCredentials>& creds);
+std::shared_ptr<Channel> CreateTestChannel(
+ const grpc::string& server, const grpc::string& override_hostname,
+ bool enable_ssl, bool use_prod_roots,
+ const std::shared_ptr<CallCredentials>& creds,
+ const ChannelArguments& args);
+
} // namespace grpc
#endif // GRPC_TEST_CPP_UTIL_CREATE_TEST_CHANNEL_H
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index c07048578a..bbb464d865 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -779,6 +779,21 @@ src/core/ext/census/census_rpc_stats.h \
src/core/ext/census/grpc_filter.h \
src/core/ext/census/mlog.h \
src/core/ext/census/rpc_metric_id.h \
+src/core/ext/client_config/client_channel.h \
+src/core/ext/client_config/client_channel_factory.h \
+src/core/ext/client_config/client_config.h \
+src/core/ext/client_config/connector.h \
+src/core/ext/client_config/initial_connect_string.h \
+src/core/ext/client_config/lb_policy.h \
+src/core/ext/client_config/lb_policy_factory.h \
+src/core/ext/client_config/lb_policy_registry.h \
+src/core/ext/client_config/resolver.h \
+src/core/ext/client_config/resolver_factory.h \
+src/core/ext/client_config/resolver_registry.h \
+src/core/ext/client_config/subchannel.h \
+src/core/ext/client_config/subchannel_call_holder.h \
+src/core/ext/client_config/subchannel_index.h \
+src/core/ext/client_config/uri_parser.h \
src/core/ext/lb_policy/grpclb/load_balancer_api.h \
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h \
src/core/ext/transport/chttp2/transport/alpn.h \
@@ -805,26 +820,11 @@ src/core/ext/transport/chttp2/transport/varint.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/client_channel.h \
src/core/lib/channel/compress_filter.h \
src/core/lib/channel/connected_channel.h \
src/core/lib/channel/context.h \
src/core/lib/channel/http_client_filter.h \
src/core/lib/channel/http_server_filter.h \
-src/core/lib/channel/subchannel_call_holder.h \
-src/core/lib/client_config/client_config.h \
-src/core/lib/client_config/connector.h \
-src/core/lib/client_config/initial_connect_string.h \
-src/core/lib/client_config/lb_policy.h \
-src/core/lib/client_config/lb_policy_factory.h \
-src/core/lib/client_config/lb_policy_registry.h \
-src/core/lib/client_config/resolver.h \
-src/core/lib/client_config/resolver_factory.h \
-src/core/lib/client_config/resolver_registry.h \
-src/core/lib/client_config/subchannel.h \
-src/core/lib/client_config/subchannel_factory.h \
-src/core/lib/client_config/subchannel_index.h \
-src/core/lib/client_config/uri_parser.h \
src/core/lib/compression/algorithm_metadata.h \
src/core/lib/compression/message_compress.h \
src/core/lib/debug/trace.h \
@@ -917,6 +917,23 @@ src/core/ext/census/mlog.c \
src/core/ext/census/operation.c \
src/core/ext/census/placeholders.c \
src/core/ext/census/tracing.c \
+src/core/ext/client_config/channel_connectivity.c \
+src/core/ext/client_config/client_channel.c \
+src/core/ext/client_config/client_channel_factory.c \
+src/core/ext/client_config/client_config.c \
+src/core/ext/client_config/connector.c \
+src/core/ext/client_config/default_initial_connect_string.c \
+src/core/ext/client_config/initial_connect_string.c \
+src/core/ext/client_config/lb_policy.c \
+src/core/ext/client_config/lb_policy_factory.c \
+src/core/ext/client_config/lb_policy_registry.c \
+src/core/ext/client_config/resolver.c \
+src/core/ext/client_config/resolver_factory.c \
+src/core/ext/client_config/resolver_registry.c \
+src/core/ext/client_config/subchannel.c \
+src/core/ext/client_config/subchannel_call_holder.c \
+src/core/ext/client_config/subchannel_index.c \
+src/core/ext/client_config/uri_parser.c \
src/core/ext/lb_policy/grpclb/load_balancer_api.c \
src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c \
src/core/ext/lb_policy/pick_first/pick_first.c \
@@ -951,26 +968,10 @@ src/core/ext/transport/chttp2/transport/writing.c \
src/core/lib/channel/channel_args.c \
src/core/lib/channel/channel_stack.c \
src/core/lib/channel/channel_stack_builder.c \
-src/core/lib/channel/client_channel.c \
src/core/lib/channel/compress_filter.c \
src/core/lib/channel/connected_channel.c \
src/core/lib/channel/http_client_filter.c \
src/core/lib/channel/http_server_filter.c \
-src/core/lib/channel/subchannel_call_holder.c \
-src/core/lib/client_config/client_config.c \
-src/core/lib/client_config/connector.c \
-src/core/lib/client_config/default_initial_connect_string.c \
-src/core/lib/client_config/initial_connect_string.c \
-src/core/lib/client_config/lb_policy.c \
-src/core/lib/client_config/lb_policy_factory.c \
-src/core/lib/client_config/lb_policy_registry.c \
-src/core/lib/client_config/resolver.c \
-src/core/lib/client_config/resolver_factory.c \
-src/core/lib/client_config/resolver_registry.c \
-src/core/lib/client_config/subchannel.c \
-src/core/lib/client_config/subchannel_factory.c \
-src/core/lib/client_config/subchannel_index.c \
-src/core/lib/client_config/uri_parser.c \
src/core/lib/compression/compression_algorithm.c \
src/core/lib/compression/message_compress.c \
src/core/lib/debug/trace.c \
@@ -1043,7 +1044,6 @@ src/core/lib/surface/call.c \
src/core/lib/surface/call_details.c \
src/core/lib/surface/call_log_batch.c \
src/core/lib/surface/channel.c \
-src/core/lib/surface/channel_connectivity.c \
src/core/lib/surface/channel_init.c \
src/core/lib/surface/channel_ping.c \
src/core/lib/surface/channel_stack_type.c \
diff --git a/tools/gce/create_interop_worker.sh b/tools/gce/create_interop_worker.sh
index 3c49c6102a..9170d82144 100755
--- a/tools/gce/create_interop_worker.sh
+++ b/tools/gce/create_interop_worker.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/tools/gource/gource.sh b/tools/gource/gource.sh
index e759c4ee60..0199609e9b 100755
--- a/tools/gource/gource.sh
+++ b/tools/gource/gource.sh
@@ -29,3 +29,4 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
gource --multi-sampling -c 4 -s 0.1 --max-file-lag 0.05 --max-files 0 -e 0.05 --hide filenames,dirnames $*
+
diff --git a/tools/run_tests/performance/__init__.py b/tools/run_tests/performance/__init__.py
new file mode 100644
index 0000000000..100a624dc9
--- /dev/null
+++ b/tools/run_tests/performance/__init__.py
@@ -0,0 +1,28 @@
+# Copyright 2016, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/tools/run_tests/performance/build_performance.sh b/tools/run_tests/performance/build_performance.sh
index 829c2e3040..b33ee3a58c 100755
--- a/tools/run_tests/performance/build_performance.sh
+++ b/tools/run_tests/performance/build_performance.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -36,16 +36,17 @@ cd $(dirname $0)/../../..
CONFIG=${CONFIG:-opt}
+# build C++ qps worker & driver always - we need at least the driver to
+# run any of the scenarios.
+# TODO(jtattermusch): not embedding OpenSSL breaks the C# build because
+# grpc_csharp_ext needs OpenSSL embedded and some intermediate files from
+# this build will be reused.
+make CONFIG=${CONFIG} EMBED_OPENSSL=true EMBED_ZLIB=true qps_worker qps_driver -j8
+
for language in $@
do
- if [ "$language" == "c++" ]
+ if [ "$language" != "c++" ]
then
- # build C++ qps worker & driver
- # TODO(jtattermusch): not embedding OpenSSL breaks the C# build because
- # grpc_csharp_ext needs OpenSSL embedded and some intermediate files from
- # this build will be reused.
- make CONFIG=${CONFIG} EMBED_OPENSSL=true EMBED_ZLIB=true qps_worker qps_driver -j8
- else
tools/run_tests/run_tests.py -l $language -c $CONFIG --build_only -j 8
fi
done
diff --git a/tools/run_tests/performance/remote_host_build.sh b/tools/run_tests/performance/remote_host_build.sh
index fee4167d33..b8886080a5 100755
--- a/tools/run_tests/performance/remote_host_build.sh
+++ b/tools/run_tests/performance/remote_host_build.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/tools/run_tests/performance/remote_host_prepare.sh b/tools/run_tests/performance/remote_host_prepare.sh
index c70e1d3963..18633d1420 100755
--- a/tools/run_tests/performance/remote_host_prepare.sh
+++ b/tools/run_tests/performance/remote_host_prepare.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/tools/run_tests/performance/run_worker_csharp.sh b/tools/run_tests/performance/run_worker_csharp.sh
index ce34b203c3..b91df09b42 100755
--- a/tools/run_tests/performance/run_worker_csharp.sh
+++ b/tools/run_tests/performance/run_worker_csharp.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/tools/run_tests/performance/run_worker_node.sh b/tools/run_tests/performance/run_worker_node.sh
index 36bf1b20a0..46b6ff0177 100755
--- a/tools/run_tests/performance/run_worker_node.sh
+++ b/tools/run_tests/performance/run_worker_node.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2015-2016, Google Inc.
+# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
diff --git a/tools/run_tests/performance/scenario_config.py b/tools/run_tests/performance/scenario_config.py
new file mode 100644
index 0000000000..f95e531fa2
--- /dev/null
+++ b/tools/run_tests/performance/scenario_config.py
@@ -0,0 +1,153 @@
+# Copyright 2016, Google Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# performance scenario configuration for various languages
+
+class CXXLanguage:
+
+ def __init__(self):
+ self.safename = 'cxx'
+
+ def worker_cmdline(self):
+ return ['bins/opt/qps_worker']
+
+ def worker_port_offset(self):
+ return 0
+
+ def scenarios(self):
+ # TODO(jtattermusch): add more scenarios
+ return {
+ # Scenario 1: generic async streaming ping-pong (contentionless latency)
+ 'cpp_async_generic_streaming_ping_pong': [
+ '--rpc_type=STREAMING',
+ '--client_type=ASYNC_CLIENT',
+ '--server_type=ASYNC_GENERIC_SERVER',
+ '--outstanding_rpcs_per_channel=1',
+ '--client_channels=1',
+ '--bbuf_req_size=0',
+ '--bbuf_resp_size=0',
+ '--async_client_threads=1',
+ '--async_server_threads=1',
+ '--secure_test=true',
+ '--num_servers=1',
+ '--num_clients=1',
+ '--server_core_limit=0',
+ '--client_core_limit=0'],
+ # Scenario 5: Sync unary ping-pong with protobufs
+ 'cpp_sync_unary_ping_pong_protobuf': [
+ '--rpc_type=UNARY',
+ '--client_type=SYNC_CLIENT',
+ '--server_type=SYNC_SERVER',
+ '--outstanding_rpcs_per_channel=1',
+ '--client_channels=1',
+ '--simple_req_size=0',
+ '--simple_resp_size=0',
+ '--secure_test=true',
+ '--num_servers=1',
+ '--num_clients=1',
+ '--server_core_limit=0',
+ '--client_core_limit=0']}
+
+ def __str__(self):
+ return 'c++'
+
+
+class CSharpLanguage:
+
+ def __init__(self):
+ self.safename = str(self)
+
+ def worker_cmdline(self):
+ return ['tools/run_tests/performance/run_worker_csharp.sh']
+
+ def worker_port_offset(self):
+ return 100
+
+ def scenarios(self):
+ # TODO(jtattermusch): add more scenarios
+ return {
+ # Scenario 1: generic async streaming ping-pong (contentionless latency)
+ 'csharp_async_generic_streaming_ping_pong': [
+ '--rpc_type=STREAMING',
+ '--client_type=ASYNC_CLIENT',
+ '--server_type=ASYNC_GENERIC_SERVER',
+ '--outstanding_rpcs_per_channel=1',
+ '--client_channels=1',
+ '--bbuf_req_size=0',
+ '--bbuf_resp_size=0',
+ '--async_client_threads=1',
+ '--async_server_threads=1',
+ '--secure_test=true',
+ '--num_servers=1',
+ '--num_clients=1',
+ '--server_core_limit=0',
+ '--client_core_limit=0']}
+
+ def __str__(self):
+ return 'csharp'
+
+
+class NodeLanguage:
+
+ def __init__(self):
+ pass
+ self.safename = str(self)
+
+ def worker_cmdline(self):
+ return ['tools/run_tests/performance/run_worker_node.sh']
+
+ def worker_port_offset(self):
+ return 200
+
+ def scenarios(self):
+ # TODO(jtattermusch): add more scenarios
+ return {
+ 'node_sync_unary_ping_pong_protobuf': [
+ '--rpc_type=UNARY',
+ '--client_type=ASYNC_CLIENT',
+ '--server_type=ASYNC_SERVER',
+ '--outstanding_rpcs_per_channel=1',
+ '--client_channels=1',
+ '--simple_req_size=0',
+ '--simple_resp_size=0',
+ '--secure_test=false',
+ '--num_servers=1',
+ '--num_clients=1',
+ '--server_core_limit=0',
+ '--client_core_limit=0']}
+
+ def __str__(self):
+ return 'node'
+
+
+LANGUAGES = {
+ 'c++' : CXXLanguage(),
+ 'csharp' : CSharpLanguage(),
+ 'node' : NodeLanguage(),
+}
diff --git a/tools/run_tests/run_node.sh b/tools/run_tests/run_node.sh
index 30f2c93588..44f75645f5 100755
--- a/tools/run_tests/run_node.sh
+++ b/tools/run_tests/run_node.sh
@@ -48,6 +48,7 @@ if [ "$CONFIG" = "gcov" ]
then
./node_modules/.bin/istanbul cover --dir reports/node_coverage \
-x **/interop/* ./node_modules/.bin/_mocha -- --timeout $timeout $test_directory
+ cp -r reports/node_coverage/lcov-report/* reports/node_coverage/
cd build
gcov Release/obj.target/grpc/ext/*.o
lcov --base-directory . --directory . -c -o coverage.info
@@ -55,8 +56,6 @@ then
genhtml -o ../reports/node_ext_coverage --num-spaces 2 \
-t 'Node gRPC test coverage' coverage.info --rc genhtml_hi_limit=95 \
--rc genhtml_med_limit=80 --no-prefix
- echo '<html><head><meta http-equiv="refresh" content="0;URL=lcov-report/index.html"></head></html>' > \
- ../reports/node_coverage/index.html
else
JUNIT_REPORT_PATH=src/node/report.xml JUNIT_REPORT_STACK=1 \
./node_modules/.bin/mocha --timeout $timeout \
diff --git a/tools/run_tests/run_performance_tests.py b/tools/run_tests/run_performance_tests.py
index 0ab3d264a5..e1268e2ecb 100755
--- a/tools/run_tests/run_performance_tests.py
+++ b/tools/run_tests/run_performance_tests.py
@@ -40,6 +40,7 @@ import sys
import tempfile
import time
import uuid
+import performance.scenario_config as scenario_config
_ROOT = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '../..'))
@@ -49,130 +50,6 @@ os.chdir(_ROOT)
_REMOTE_HOST_USERNAME = 'jenkins'
-class CXXLanguage:
-
- def __init__(self):
- self.safename = 'cxx'
-
- def worker_cmdline(self):
- return ['bins/opt/qps_worker']
-
- def worker_port_offset(self):
- return 0
-
- def scenarios(self):
- # TODO(jtattermusch): add more scenarios
- return {
- # Scenario 1: generic async streaming ping-pong (contentionless latency)
- 'cpp_async_generic_streaming_ping_pong': [
- '--rpc_type=STREAMING',
- '--client_type=ASYNC_CLIENT',
- '--server_type=ASYNC_GENERIC_SERVER',
- '--outstanding_rpcs_per_channel=1',
- '--client_channels=1',
- '--bbuf_req_size=0',
- '--bbuf_resp_size=0',
- '--async_client_threads=1',
- '--async_server_threads=1',
- '--secure_test=true',
- '--num_servers=1',
- '--num_clients=1',
- '--server_core_limit=0',
- '--client_core_limit=0'],
- # Scenario 5: Sync unary ping-pong with protobufs
- 'cpp_sync_unary_ping_pong_protobuf': [
- '--rpc_type=UNARY',
- '--client_type=SYNC_CLIENT',
- '--server_type=SYNC_SERVER',
- '--outstanding_rpcs_per_channel=1',
- '--client_channels=1',
- '--simple_req_size=0',
- '--simple_resp_size=0',
- '--secure_test=true',
- '--num_servers=1',
- '--num_clients=1',
- '--server_core_limit=0',
- '--client_core_limit=0']}
-
- def __str__(self):
- return 'c++'
-
-
-class CSharpLanguage:
-
- def __init__(self):
- self.safename = str(self)
-
- def worker_cmdline(self):
- return ['tools/run_tests/performance/run_worker_csharp.sh']
-
- def worker_port_offset(self):
- return 100
-
- def scenarios(self):
- # TODO(jtattermusch): add more scenarios
- return {
- # Scenario 1: generic async streaming ping-pong (contentionless latency)
- 'csharp_async_generic_streaming_ping_pong': [
- '--rpc_type=STREAMING',
- '--client_type=ASYNC_CLIENT',
- '--server_type=ASYNC_GENERIC_SERVER',
- '--outstanding_rpcs_per_channel=1',
- '--client_channels=1',
- '--bbuf_req_size=0',
- '--bbuf_resp_size=0',
- '--async_client_threads=1',
- '--async_server_threads=1',
- '--secure_test=true',
- '--num_servers=1',
- '--num_clients=1',
- '--server_core_limit=0',
- '--client_core_limit=0']}
-
- def __str__(self):
- return 'csharp'
-
-
-class NodeLanguage:
-
- def __init__(self):
- pass
- self.safename = str(self)
-
- def worker_cmdline(self):
- return ['tools/run_tests/performance/run_worker_node.sh']
-
- def worker_port_offset(self):
- return 200
-
- def scenarios(self):
- # TODO(jtattermusch): add more scenarios
- return {
- 'node_sync_unary_ping_pong_protobuf': [
- '--rpc_type=UNARY',
- '--client_type=ASYNC_CLIENT',
- '--server_type=ASYNC_SERVER',
- '--outstanding_rpcs_per_channel=1',
- '--client_channels=1',
- '--simple_req_size=0',
- '--simple_resp_size=0',
- '--secure_test=false',
- '--num_servers=1',
- '--num_clients=1',
- '--server_core_limit=0',
- '--client_core_limit=0']}
-
- def __str__(self):
- return 'node'
-
-
-_LANGUAGES = {
- 'c++' : CXXLanguage(),
- 'csharp' : CSharpLanguage(),
- 'node' : NodeLanguage(),
-}
-
-
class QpsWorkerJob:
"""Encapsulates a qps worker server job."""
@@ -272,7 +149,7 @@ def prepare_remote_hosts(hosts):
sys.exit(1)
-def build_on_remote_hosts(hosts, languages=_LANGUAGES.keys(), build_local=False):
+def build_on_remote_hosts(hosts, languages=scenario_config.LANGUAGES.keys(), build_local=False):
"""Builds performance worker on remote hosts (and maybe also locally)."""
build_timeout = 15*60
build_jobs = []
@@ -366,7 +243,7 @@ def finish_qps_workers(jobs):
argp = argparse.ArgumentParser(description='Run performance tests.')
argp.add_argument('-l', '--language',
- choices=['all'] + sorted(_LANGUAGES.keys()),
+ choices=['all'] + sorted(scenario_config.LANGUAGES.keys()),
nargs='+',
default=['all'],
help='Languages to benchmark.')
@@ -380,9 +257,9 @@ argp.add_argument('--remote_worker_host',
args = argp.parse_args()
-languages = set(_LANGUAGES[l]
+languages = set(scenario_config.LANGUAGES[l]
for l in itertools.chain.from_iterable(
- _LANGUAGES.iterkeys() if x == 'all' else [x]
+ scenario_config.LANGUAGES.iterkeys() if x == 'all' else [x]
for x in args.language))
# Put together set of remote hosts where to run and build
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 0d18d87f42..aa9feaee2b 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -4123,6 +4123,21 @@
"src/core/ext/census/grpc_filter.h",
"src/core/ext/census/mlog.h",
"src/core/ext/census/rpc_metric_id.h",
+ "src/core/ext/client_config/client_channel.h",
+ "src/core/ext/client_config/client_channel_factory.h",
+ "src/core/ext/client_config/client_config.h",
+ "src/core/ext/client_config/connector.h",
+ "src/core/ext/client_config/initial_connect_string.h",
+ "src/core/ext/client_config/lb_policy.h",
+ "src/core/ext/client_config/lb_policy_factory.h",
+ "src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/resolver.h",
+ "src/core/ext/client_config/resolver_factory.h",
+ "src/core/ext/client_config/resolver_registry.h",
+ "src/core/ext/client_config/subchannel.h",
+ "src/core/ext/client_config/subchannel_call_holder.h",
+ "src/core/ext/client_config/subchannel_index.h",
+ "src/core/ext/client_config/uri_parser.h",
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/ext/transport/chttp2/transport/alpn.h",
@@ -4149,26 +4164,11 @@
"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/client_channel.h",
"src/core/lib/channel/compress_filter.h",
"src/core/lib/channel/connected_channel.h",
"src/core/lib/channel/context.h",
"src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.h",
- "src/core/lib/channel/subchannel_call_holder.h",
- "src/core/lib/client_config/client_config.h",
- "src/core/lib/client_config/connector.h",
- "src/core/lib/client_config/initial_connect_string.h",
- "src/core/lib/client_config/lb_policy.h",
- "src/core/lib/client_config/lb_policy_factory.h",
- "src/core/lib/client_config/lb_policy_registry.h",
- "src/core/lib/client_config/resolver.h",
- "src/core/lib/client_config/resolver_factory.h",
- "src/core/lib/client_config/resolver_registry.h",
- "src/core/lib/client_config/subchannel.h",
- "src/core/lib/client_config/subchannel_factory.h",
- "src/core/lib/client_config/subchannel_index.h",
- "src/core/lib/client_config/uri_parser.h",
"src/core/lib/compression/algorithm_metadata.h",
"src/core/lib/compression/message_compress.h",
"src/core/lib/debug/trace.h",
@@ -4284,6 +4284,38 @@
"src/core/ext/census/placeholders.c",
"src/core/ext/census/rpc_metric_id.h",
"src/core/ext/census/tracing.c",
+ "src/core/ext/client_config/channel_connectivity.c",
+ "src/core/ext/client_config/client_channel.c",
+ "src/core/ext/client_config/client_channel.h",
+ "src/core/ext/client_config/client_channel_factory.c",
+ "src/core/ext/client_config/client_channel_factory.h",
+ "src/core/ext/client_config/client_config.c",
+ "src/core/ext/client_config/client_config.h",
+ "src/core/ext/client_config/connector.c",
+ "src/core/ext/client_config/connector.h",
+ "src/core/ext/client_config/default_initial_connect_string.c",
+ "src/core/ext/client_config/initial_connect_string.c",
+ "src/core/ext/client_config/initial_connect_string.h",
+ "src/core/ext/client_config/lb_policy.c",
+ "src/core/ext/client_config/lb_policy.h",
+ "src/core/ext/client_config/lb_policy_factory.c",
+ "src/core/ext/client_config/lb_policy_factory.h",
+ "src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/resolver.c",
+ "src/core/ext/client_config/resolver.h",
+ "src/core/ext/client_config/resolver_factory.c",
+ "src/core/ext/client_config/resolver_factory.h",
+ "src/core/ext/client_config/resolver_registry.c",
+ "src/core/ext/client_config/resolver_registry.h",
+ "src/core/ext/client_config/subchannel.c",
+ "src/core/ext/client_config/subchannel.h",
+ "src/core/ext/client_config/subchannel_call_holder.c",
+ "src/core/ext/client_config/subchannel_call_holder.h",
+ "src/core/ext/client_config/subchannel_index.c",
+ "src/core/ext/client_config/subchannel_index.h",
+ "src/core/ext/client_config/uri_parser.c",
+ "src/core/ext/client_config/uri_parser.h",
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c",
@@ -4344,8 +4376,6 @@
"src/core/lib/channel/channel_stack.h",
"src/core/lib/channel/channel_stack_builder.c",
"src/core/lib/channel/channel_stack_builder.h",
- "src/core/lib/channel/client_channel.c",
- "src/core/lib/channel/client_channel.h",
"src/core/lib/channel/compress_filter.c",
"src/core/lib/channel/compress_filter.h",
"src/core/lib/channel/connected_channel.c",
@@ -4355,35 +4385,6 @@
"src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.c",
"src/core/lib/channel/http_server_filter.h",
- "src/core/lib/channel/subchannel_call_holder.c",
- "src/core/lib/channel/subchannel_call_holder.h",
- "src/core/lib/client_config/client_config.c",
- "src/core/lib/client_config/client_config.h",
- "src/core/lib/client_config/connector.c",
- "src/core/lib/client_config/connector.h",
- "src/core/lib/client_config/default_initial_connect_string.c",
- "src/core/lib/client_config/initial_connect_string.c",
- "src/core/lib/client_config/initial_connect_string.h",
- "src/core/lib/client_config/lb_policy.c",
- "src/core/lib/client_config/lb_policy.h",
- "src/core/lib/client_config/lb_policy_factory.c",
- "src/core/lib/client_config/lb_policy_factory.h",
- "src/core/lib/client_config/lb_policy_registry.c",
- "src/core/lib/client_config/lb_policy_registry.h",
- "src/core/lib/client_config/resolver.c",
- "src/core/lib/client_config/resolver.h",
- "src/core/lib/client_config/resolver_factory.c",
- "src/core/lib/client_config/resolver_factory.h",
- "src/core/lib/client_config/resolver_registry.c",
- "src/core/lib/client_config/resolver_registry.h",
- "src/core/lib/client_config/subchannel.c",
- "src/core/lib/client_config/subchannel.h",
- "src/core/lib/client_config/subchannel_factory.c",
- "src/core/lib/client_config/subchannel_factory.h",
- "src/core/lib/client_config/subchannel_index.c",
- "src/core/lib/client_config/subchannel_index.h",
- "src/core/lib/client_config/uri_parser.c",
- "src/core/lib/client_config/uri_parser.h",
"src/core/lib/compression/algorithm_metadata.h",
"src/core/lib/compression/compression_algorithm.c",
"src/core/lib/compression/message_compress.c",
@@ -4515,7 +4516,6 @@
"src/core/lib/surface/call_test_only.h",
"src/core/lib/surface/channel.c",
"src/core/lib/surface/channel.h",
- "src/core/lib/surface/channel_connectivity.c",
"src/core/lib/surface/channel_init.c",
"src/core/lib/surface/channel_init.h",
"src/core/lib/surface/channel_ping.c",
@@ -4743,6 +4743,21 @@
"src/core/ext/census/grpc_filter.h",
"src/core/ext/census/mlog.h",
"src/core/ext/census/rpc_metric_id.h",
+ "src/core/ext/client_config/client_channel.h",
+ "src/core/ext/client_config/client_channel_factory.h",
+ "src/core/ext/client_config/client_config.h",
+ "src/core/ext/client_config/connector.h",
+ "src/core/ext/client_config/initial_connect_string.h",
+ "src/core/ext/client_config/lb_policy.h",
+ "src/core/ext/client_config/lb_policy_factory.h",
+ "src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/resolver.h",
+ "src/core/ext/client_config/resolver_factory.h",
+ "src/core/ext/client_config/resolver_registry.h",
+ "src/core/ext/client_config/subchannel.h",
+ "src/core/ext/client_config/subchannel_call_holder.h",
+ "src/core/ext/client_config/subchannel_index.h",
+ "src/core/ext/client_config/uri_parser.h",
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.h",
"src/core/ext/transport/chttp2/transport/alpn.h",
@@ -4769,26 +4784,11 @@
"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/client_channel.h",
"src/core/lib/channel/compress_filter.h",
"src/core/lib/channel/connected_channel.h",
"src/core/lib/channel/context.h",
"src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.h",
- "src/core/lib/channel/subchannel_call_holder.h",
- "src/core/lib/client_config/client_config.h",
- "src/core/lib/client_config/connector.h",
- "src/core/lib/client_config/initial_connect_string.h",
- "src/core/lib/client_config/lb_policy.h",
- "src/core/lib/client_config/lb_policy_factory.h",
- "src/core/lib/client_config/lb_policy_registry.h",
- "src/core/lib/client_config/resolver.h",
- "src/core/lib/client_config/resolver_factory.h",
- "src/core/lib/client_config/resolver_registry.h",
- "src/core/lib/client_config/subchannel.h",
- "src/core/lib/client_config/subchannel_factory.h",
- "src/core/lib/client_config/subchannel_index.h",
- "src/core/lib/client_config/uri_parser.h",
"src/core/lib/compression/algorithm_metadata.h",
"src/core/lib/compression/message_compress.h",
"src/core/lib/debug/trace.h",
@@ -4889,6 +4889,38 @@
"src/core/ext/census/placeholders.c",
"src/core/ext/census/rpc_metric_id.h",
"src/core/ext/census/tracing.c",
+ "src/core/ext/client_config/channel_connectivity.c",
+ "src/core/ext/client_config/client_channel.c",
+ "src/core/ext/client_config/client_channel.h",
+ "src/core/ext/client_config/client_channel_factory.c",
+ "src/core/ext/client_config/client_channel_factory.h",
+ "src/core/ext/client_config/client_config.c",
+ "src/core/ext/client_config/client_config.h",
+ "src/core/ext/client_config/connector.c",
+ "src/core/ext/client_config/connector.h",
+ "src/core/ext/client_config/default_initial_connect_string.c",
+ "src/core/ext/client_config/initial_connect_string.c",
+ "src/core/ext/client_config/initial_connect_string.h",
+ "src/core/ext/client_config/lb_policy.c",
+ "src/core/ext/client_config/lb_policy.h",
+ "src/core/ext/client_config/lb_policy_factory.c",
+ "src/core/ext/client_config/lb_policy_factory.h",
+ "src/core/ext/client_config/lb_policy_registry.c",
+ "src/core/ext/client_config/lb_policy_registry.h",
+ "src/core/ext/client_config/resolver.c",
+ "src/core/ext/client_config/resolver.h",
+ "src/core/ext/client_config/resolver_factory.c",
+ "src/core/ext/client_config/resolver_factory.h",
+ "src/core/ext/client_config/resolver_registry.c",
+ "src/core/ext/client_config/resolver_registry.h",
+ "src/core/ext/client_config/subchannel.c",
+ "src/core/ext/client_config/subchannel.h",
+ "src/core/ext/client_config/subchannel_call_holder.c",
+ "src/core/ext/client_config/subchannel_call_holder.h",
+ "src/core/ext/client_config/subchannel_index.c",
+ "src/core/ext/client_config/subchannel_index.h",
+ "src/core/ext/client_config/uri_parser.c",
+ "src/core/ext/client_config/uri_parser.h",
"src/core/ext/lb_policy/grpclb/load_balancer_api.c",
"src/core/ext/lb_policy/grpclb/load_balancer_api.h",
"src/core/ext/lb_policy/grpclb/proto/grpc/lb/v0/load_balancer.pb.c",
@@ -4947,8 +4979,6 @@
"src/core/lib/channel/channel_stack.h",
"src/core/lib/channel/channel_stack_builder.c",
"src/core/lib/channel/channel_stack_builder.h",
- "src/core/lib/channel/client_channel.c",
- "src/core/lib/channel/client_channel.h",
"src/core/lib/channel/compress_filter.c",
"src/core/lib/channel/compress_filter.h",
"src/core/lib/channel/connected_channel.c",
@@ -4958,35 +4988,6 @@
"src/core/lib/channel/http_client_filter.h",
"src/core/lib/channel/http_server_filter.c",
"src/core/lib/channel/http_server_filter.h",
- "src/core/lib/channel/subchannel_call_holder.c",
- "src/core/lib/channel/subchannel_call_holder.h",
- "src/core/lib/client_config/client_config.c",
- "src/core/lib/client_config/client_config.h",
- "src/core/lib/client_config/connector.c",
- "src/core/lib/client_config/connector.h",
- "src/core/lib/client_config/default_initial_connect_string.c",
- "src/core/lib/client_config/initial_connect_string.c",
- "src/core/lib/client_config/initial_connect_string.h",
- "src/core/lib/client_config/lb_policy.c",
- "src/core/lib/client_config/lb_policy.h",
- "src/core/lib/client_config/lb_policy_factory.c",
- "src/core/lib/client_config/lb_policy_factory.h",
- "src/core/lib/client_config/lb_policy_registry.c",
- "src/core/lib/client_config/lb_policy_registry.h",
- "src/core/lib/client_config/resolver.c",
- "src/core/lib/client_config/resolver.h",
- "src/core/lib/client_config/resolver_factory.c",
- "src/core/lib/client_config/resolver_factory.h",
- "src/core/lib/client_config/resolver_registry.c",
- "src/core/lib/client_config/resolver_registry.h",
- "src/core/lib/client_config/subchannel.c",
- "src/core/lib/client_config/subchannel.h",
- "src/core/lib/client_config/subchannel_factory.c",
- "src/core/lib/client_config/subchannel_factory.h",
- "src/core/lib/client_config/subchannel_index.c",
- "src/core/lib/client_config/subchannel_index.h",
- "src/core/lib/client_config/uri_parser.c",
- "src/core/lib/client_config/uri_parser.h",
"src/core/lib/compression/algorithm_metadata.h",
"src/core/lib/compression/compression_algorithm.c",
"src/core/lib/compression/message_compress.c",
@@ -5094,7 +5095,6 @@
"src/core/lib/surface/call_test_only.h",
"src/core/lib/surface/channel.c",
"src/core/lib/surface/channel.h",
- "src/core/lib/surface/channel_connectivity.c",
"src/core/lib/surface/channel_init.c",
"src/core/lib/surface/channel_init.h",
"src/core/lib/surface/channel_ping.c",
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj
index f54c8c643d..5599e0ecd6 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj
@@ -288,6 +288,21 @@
<ClInclude Include="$(SolutionDir)\..\src\core\ext\census\grpc_filter.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\census\mlog.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\census\rpc_metric_id.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel_factory.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_config.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\connector.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\initial_connect_string.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_call_holder.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_index.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\uri_parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\load_balancer_api.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0\load_balancer.pb.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\transport\chttp2\transport\alpn.h" />
@@ -314,26 +329,11 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\channel_args.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack_builder.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\client_channel.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\compress_filter.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\connected_channel.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\context.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\http_client_filter.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\http_server_filter.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\subchannel_call_holder.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\client_config.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\connector.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\initial_connect_string.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_factory.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_registry.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_factory.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_registry.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_factory.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_index.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\uri_parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\compression\algorithm_metadata.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\compression\message_compress.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\debug\trace.h" />
@@ -437,6 +437,40 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\census\tracing.c">
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\channel_connectivity.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel_factory.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_config.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\connector.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\default_initial_connect_string.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\initial_connect_string.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_call_holder.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_index.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\uri_parser.c">
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\load_balancer_api.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0\load_balancer.pb.c">
@@ -505,8 +539,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack_builder.c">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\client_channel.c">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\compress_filter.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\connected_channel.c">
@@ -515,36 +547,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\http_server_filter.c">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\subchannel_call_holder.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\client_config.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\connector.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\default_initial_connect_string.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\initial_connect_string.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_factory.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_registry.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_factory.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_registry.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_factory.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_index.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\uri_parser.c">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\compression\compression_algorithm.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\compression\message_compress.c">
@@ -689,8 +691,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel.c">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_connectivity.c">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_init.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_ping.c">
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
index c00b928571..e49b8447d8 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
@@ -28,6 +28,57 @@
<ClCompile Include="$(SolutionDir)\..\src\core\ext\census\tracing.c">
<Filter>src\core\ext\census</Filter>
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\channel_connectivity.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel_factory.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_config.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\connector.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\default_initial_connect_string.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\initial_connect_string.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_call_holder.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_index.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\uri_parser.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\load_balancer_api.c">
<Filter>src\core\ext\lb_policy\grpclb</Filter>
</ClCompile>
@@ -130,9 +181,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack_builder.c">
<Filter>src\core\lib\channel</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\client_channel.c">
- <Filter>src\core\lib\channel</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\compress_filter.c">
<Filter>src\core\lib\channel</Filter>
</ClCompile>
@@ -145,51 +193,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\http_server_filter.c">
<Filter>src\core\lib\channel</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\subchannel_call_holder.c">
- <Filter>src\core\lib\channel</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\client_config.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\connector.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\default_initial_connect_string.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\initial_connect_string.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_factory.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_registry.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_factory.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_registry.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_factory.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_index.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\uri_parser.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\compression\compression_algorithm.c">
<Filter>src\core\lib\compression</Filter>
</ClCompile>
@@ -406,9 +409,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel.c">
<Filter>src\core\lib\surface</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_connectivity.c">
- <Filter>src\core\lib\surface</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_init.c">
<Filter>src\core\lib\surface</Filter>
</ClCompile>
@@ -548,6 +548,51 @@
<ClInclude Include="$(SolutionDir)\..\src\core\ext\census\rpc_metric_id.h">
<Filter>src\core\ext\census</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel_factory.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_config.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\connector.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\initial_connect_string.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_call_holder.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_index.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\uri_parser.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\load_balancer_api.h">
<Filter>src\core\ext\lb_policy\grpclb</Filter>
</ClInclude>
@@ -626,9 +671,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack_builder.h">
<Filter>src\core\lib\channel</Filter>
</ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\client_channel.h">
- <Filter>src\core\lib\channel</Filter>
- </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\compress_filter.h">
<Filter>src\core\lib\channel</Filter>
</ClInclude>
@@ -644,48 +686,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\http_server_filter.h">
<Filter>src\core\lib\channel</Filter>
</ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\subchannel_call_holder.h">
- <Filter>src\core\lib\channel</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\client_config.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\connector.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\initial_connect_string.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_factory.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_registry.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_factory.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_registry.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_factory.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_index.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\uri_parser.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\compression\algorithm_metadata.h">
<Filter>src\core\lib\compression</Filter>
</ClInclude>
@@ -962,6 +962,9 @@
<Filter Include="src\core\ext\census">
<UniqueIdentifier>{9bf70bd2-f553-11b2-c237-abd148971eea}</UniqueIdentifier>
</Filter>
+ <Filter Include="src\core\ext\client_config">
+ <UniqueIdentifier>{003725f8-37fc-80b5-deba-baae32caf915}</UniqueIdentifier>
+ </Filter>
<Filter Include="src\core\ext\lb_policy">
<UniqueIdentifier>{030f00ff-6c54-76c8-12df-37e3008335d1}</UniqueIdentifier>
</Filter>
@@ -1031,9 +1034,6 @@
<Filter Include="src\core\lib\channel">
<UniqueIdentifier>{1931b044-90f3-cd68-b5f8-23be77ca8efc}</UniqueIdentifier>
</Filter>
- <Filter Include="src\core\lib\client_config">
- <UniqueIdentifier>{2f3260de-be57-d18d-6882-61d115baa159}</UniqueIdentifier>
- </Filter>
<Filter Include="src\core\lib\compression">
<UniqueIdentifier>{dadf7fe9-3f15-d431-e4f6-f987b090536c}</UniqueIdentifier>
</Filter>
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
index ec8624fb34..ad9589d347 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
@@ -278,6 +278,21 @@
<ClInclude Include="$(SolutionDir)\..\src\core\ext\census\grpc_filter.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\census\mlog.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\census\rpc_metric_id.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel_factory.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_config.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\connector.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\initial_connect_string.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_call_holder.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_index.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\uri_parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\load_balancer_api.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0\load_balancer.pb.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\ext\transport\chttp2\transport\alpn.h" />
@@ -304,26 +319,11 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\channel_args.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack_builder.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\client_channel.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\compress_filter.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\connected_channel.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\context.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\http_client_filter.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\http_server_filter.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\subchannel_call_holder.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\client_config.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\connector.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\initial_connect_string.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_factory.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_registry.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_factory.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_registry.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_factory.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_index.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\uri_parser.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\compression\algorithm_metadata.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\compression\message_compress.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\debug\trace.h" />
@@ -413,6 +413,40 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\census\tracing.c">
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\channel_connectivity.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel_factory.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_config.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\connector.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\default_initial_connect_string.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\initial_connect_string.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_call_holder.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_index.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\uri_parser.c">
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\load_balancer_api.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\proto\grpc\lb\v0\load_balancer.pb.c">
@@ -477,8 +511,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack_builder.c">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\client_channel.c">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\compress_filter.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\connected_channel.c">
@@ -487,36 +519,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\http_server_filter.c">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\subchannel_call_holder.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\client_config.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\connector.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\default_initial_connect_string.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\initial_connect_string.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_factory.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_registry.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_factory.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_registry.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_factory.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_index.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\uri_parser.c">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\compression\compression_algorithm.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\compression\message_compress.c">
@@ -631,8 +633,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel.c">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_connectivity.c">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_init.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_ping.c">
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
index 95b76b33de..c26b8befd8 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
@@ -28,6 +28,57 @@
<ClCompile Include="$(SolutionDir)\..\src\core\ext\census\tracing.c">
<Filter>src\core\ext\census</Filter>
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\channel_connectivity.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel_factory.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\client_config.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\connector.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\default_initial_connect_string.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\initial_connect_string.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_call_holder.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_index.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\ext\client_config\uri_parser.c">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\load_balancer_api.c">
<Filter>src\core\ext\lb_policy\grpclb</Filter>
</ClCompile>
@@ -124,9 +175,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack_builder.c">
<Filter>src\core\lib\channel</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\client_channel.c">
- <Filter>src\core\lib\channel</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\compress_filter.c">
<Filter>src\core\lib\channel</Filter>
</ClCompile>
@@ -139,51 +187,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\http_server_filter.c">
<Filter>src\core\lib\channel</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\channel\subchannel_call_holder.c">
- <Filter>src\core\lib\channel</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\client_config.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\connector.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\default_initial_connect_string.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\initial_connect_string.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_factory.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_registry.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_factory.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_registry.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_factory.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_index.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\client_config\uri_parser.c">
- <Filter>src\core\lib\client_config</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\compression\compression_algorithm.c">
<Filter>src\core\lib\compression</Filter>
</ClCompile>
@@ -355,9 +358,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel.c">
<Filter>src\core\lib\surface</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_connectivity.c">
- <Filter>src\core\lib\surface</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\channel_init.c">
<Filter>src\core\lib\surface</Filter>
</ClCompile>
@@ -485,6 +485,51 @@
<ClInclude Include="$(SolutionDir)\..\src\core\ext\census\rpc_metric_id.h">
<Filter>src\core\ext\census</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_channel_factory.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\client_config.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\connector.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\initial_connect_string.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_factory.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\lb_policy_registry.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_factory.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\resolver_registry.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_call_holder.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\subchannel_index.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\ext\client_config\uri_parser.h">
+ <Filter>src\core\ext\client_config</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\ext\lb_policy\grpclb\load_balancer_api.h">
<Filter>src\core\ext\lb_policy\grpclb</Filter>
</ClInclude>
@@ -563,9 +608,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\channel_stack_builder.h">
<Filter>src\core\lib\channel</Filter>
</ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\client_channel.h">
- <Filter>src\core\lib\channel</Filter>
- </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\compress_filter.h">
<Filter>src\core\lib\channel</Filter>
</ClInclude>
@@ -581,48 +623,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\http_server_filter.h">
<Filter>src\core\lib\channel</Filter>
</ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\channel\subchannel_call_holder.h">
- <Filter>src\core\lib\channel</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\client_config.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\connector.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\initial_connect_string.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_factory.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\lb_policy_registry.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_factory.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\resolver_registry.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_factory.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\subchannel_index.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\client_config\uri_parser.h">
- <Filter>src\core\lib\client_config</Filter>
- </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\compression\algorithm_metadata.h">
<Filter>src\core\lib\compression</Filter>
</ClInclude>
@@ -857,6 +857,9 @@
<Filter Include="src\core\ext\census">
<UniqueIdentifier>{3f21cd12-b8b9-18f8-8780-e21bbe2285d0}</UniqueIdentifier>
</Filter>
+ <Filter Include="src\core\ext\client_config">
+ <UniqueIdentifier>{25fa8af3-0a05-987c-741f-fa8ff9d65d51}</UniqueIdentifier>
+ </Filter>
<Filter Include="src\core\ext\lb_policy">
<UniqueIdentifier>{a23781d2-27e4-7cb0-12cd-59782ecb21ce}</UniqueIdentifier>
</Filter>
@@ -920,9 +923,6 @@
<Filter Include="src\core\lib\channel">
<UniqueIdentifier>{fb964f3d-a59c-a7ba-fee5-6072dbb94a7b}</UniqueIdentifier>
</Filter>
- <Filter Include="src\core\lib\client_config">
- <UniqueIdentifier>{29ca2974-89e4-1a74-3e4d-0d63e2f77566}</UniqueIdentifier>
- </Filter>
<Filter Include="src\core\lib\compression">
<UniqueIdentifier>{b88002e9-185e-4e64-49f5-2d8989ce87f6}</UniqueIdentifier>
</Filter>