aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-10-24 16:55:23 -0700
committerGravatar Muxi Yan <mxyan@google.com>2018-10-24 17:04:12 -0700
commitc2bb7550377898e6985662d0ca9048c07bde6810 (patch)
treed8d812f07d18e8ce27a88af8e8d6db54fbc1fded
parent3c33020357e58202a9909d739353f4c20f78e817 (diff)
Move GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER into core
-rw-r--r--src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc14
-rw-r--r--src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m3
-rw-r--r--src/objective-c/GRPCClient/private/GRPCWrappedCall.m4
-rw-r--r--src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm6
-rw-r--r--src/objective-c/tests/CronetUnitTests/CronetUnitTests.m13
5 files changed, 16 insertions, 24 deletions
diff --git a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
index 40a30e4a31..dffb61b082 100644
--- a/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
+++ b/src/core/ext/transport/cronet/client/secure/cronet_channel_create.cc
@@ -46,9 +46,19 @@ GRPCAPI grpc_channel* grpc_cronet_secure_channel_create(
"grpc_create_cronet_transport: stream_engine = %p, target=%s", engine,
target);
+ // Disable client authority filter when using Cronet
+ grpc_arg arg;
+ arg.key = const_cast<char*>(GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER);
+ arg.type = GRPC_ARG_INTEGER;
+ arg.value.integer = 1;
+ grpc_channel_args* new_args = grpc_channel_args_copy_and_add(args, &arg, 1);
+
grpc_transport* ct =
- grpc_create_cronet_transport(engine, target, args, reserved);
+ grpc_create_cronet_transport(engine, target, new_args, reserved);
grpc_core::ExecCtx exec_ctx;
- return grpc_channel_create(target, args, GRPC_CLIENT_DIRECT_CHANNEL, ct);
+ grpc_channel* channel =
+ grpc_channel_create(target, new_args, GRPC_CLIENT_DIRECT_CHANNEL, ct);
+ grpc_channel_args_destroy(new_args);
+ return channel;
}
diff --git a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m b/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m
index b2ab03b648..51d8df0fb7 100644
--- a/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m
+++ b/src/objective-c/GRPCClient/private/GRPCCronetChannelFactory.m
@@ -54,9 +54,6 @@ NS_ASSUME_NONNULL_BEGIN
- (grpc_channel * _Nullable)createChannelWithHost:(NSString *)host
channelArgs:(NSDictionary * _Nullable)args {
- // Remove client authority filter since that is not supported
- args[@GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER] = [NSNumber numberWithInt:1];
-
grpc_channel_args *channelArgs = GRPCBuildChannelArgs(args);
grpc_channel *unmanagedChannel =
grpc_cronet_secure_channel_create(_cronetEngine, host.UTF8String, channelArgs, NULL);
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
index 4d5257aca7..100d4cf291 100644
--- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
+++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
@@ -310,7 +310,9 @@
}
- (void)dealloc {
- grpc_call_unref(_call);
+ if (_call) {
+ grpc_call_unref(_call);
+ }
[_channel unref];
_channel = nil;
}
diff --git a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
index 80fa0f4785..fe85e915d4 100644
--- a/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
+++ b/src/objective-c/tests/CoreCronetEnd2EndTests/CoreCronetEnd2EndTests.mm
@@ -81,13 +81,7 @@ static void cronet_init_client_secure_fullstack(grpc_end2end_test_fixture *f,
grpc_channel_args *client_args,
stream_engine *cronetEngine) {
fullstack_secure_fixture_data *ffd = (fullstack_secure_fixture_data *)f->fixture_data;
- grpc_arg arg;
- arg.key = const_cast<char *>(GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER);
- arg.type = GRPC_ARG_INTEGER;
- arg.value.integer = 1;
- client_args = grpc_channel_args_copy_and_add(client_args, &arg, 1);
f->client = grpc_cronet_secure_channel_create(cronetEngine, ffd->localaddr, client_args, NULL);
- grpc_channel_args_destroy(client_args);
GPR_ASSERT(f->client != NULL);
}
diff --git a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
index 84893b92c1..d732bc6ba9 100644
--- a/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
+++ b/src/objective-c/tests/CronetUnitTests/CronetUnitTests.m
@@ -124,14 +124,6 @@ unsigned int parse_h2_length(const char *field) {
((unsigned int)(unsigned char)(field[2]));
}
-grpc_channel_args *add_disable_client_authority_filter_args(grpc_channel_args *args) {
- grpc_arg arg;
- arg.key = const_cast<char *>(GRPC_ARG_DISABLE_CLIENT_AUTHORITY_FILTER);
- arg.type = GRPC_ARG_INTEGER;
- arg.value.integer = 1;
- return grpc_channel_args_copy_and_add(args, &arg, 1);
-}
-
- (void)testInternalError {
grpc_call *c;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");
@@ -151,9 +143,7 @@ grpc_channel_args *add_disable_client_authority_filter_args(grpc_channel_args *a
gpr_join_host_port(&addr, "127.0.0.1", port);
grpc_completion_queue *cq = grpc_completion_queue_create_for_next(NULL);
stream_engine *cronetEngine = [Cronet getGlobalEngine];
- grpc_channel_args *client_args = add_disable_client_authority_filter_args(NULL);
- grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, client_args, NULL);
- grpc_channel_args_destroy(client_args);
+ grpc_channel *client = grpc_cronet_secure_channel_create(cronetEngine, addr, NULL, NULL);
cq_verifier *cqv = cq_verifier_create(cq);
grpc_op ops[6];
@@ -265,7 +255,6 @@ grpc_channel_args *add_disable_client_authority_filter_args(grpc_channel_args *a
arg.type = GRPC_ARG_INTEGER;
arg.value.integer = useCoalescing ? 1 : 0;
grpc_channel_args *args = grpc_channel_args_copy_and_add(NULL, &arg, 1);
- args = add_disable_client_authority_filter_args(args);
grpc_call *c;
grpc_slice request_payload_slice = grpc_slice_from_copied_string("hello world");