diff options
author | thassss <tommy@vsco.co> | 2017-06-29 09:26:20 -0700 |
---|---|---|
committer | thassss <tommy@vsco.co> | 2017-06-29 09:26:20 -0700 |
commit | a5082db9dabb3aae114fa773d1f6edf1f8d54363 (patch) | |
tree | 9c792dfe92da88d98fb80948781e91b3c882312c /src/objective-c/GRPCClient/private | |
parent | 260ddd175977c4c19d2b06287c1db416b2a4fbf4 (diff) |
Pass NULL to grpc_channel_create_call for nil serverName
Diffstat (limited to 'src/objective-c/GRPCClient/private')
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCChannel.m | 11 | ||||
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCHost.m | 3 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 690fad2596..52dbc70b99 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -183,15 +183,20 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) { - (grpc_call *)unmanagedCallWithPath:(NSString *)path serverName:(NSString *)serverName completionQueue:(GRPCCompletionQueue *)queue { - grpc_slice host_slice = grpc_slice_from_copied_string(serverName.UTF8String); + grpc_slice host_slice; + if (serverName) { + host_slice = grpc_slice_from_copied_string(serverName.UTF8String); + } grpc_slice path_slice = grpc_slice_from_copied_string(path.UTF8String); grpc_call *call = grpc_channel_create_call(_unmanagedChannel, NULL, GRPC_PROPAGATE_DEFAULTS, queue.unmanagedQueue, path_slice, - &host_slice, + serverName ? &host_slice : NULL, gpr_inf_future(GPR_CLOCK_REALTIME), NULL); - grpc_slice_unref(host_slice); + if (serverName) { + grpc_slice_unref(host_slice); + } grpc_slice_unref(path_slice); return call; } diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index 800c548077..23794c1fed 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -130,8 +130,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil; } channel = _channel; } - NSString *name = serverName ? serverName : _address; - return [channel unmanagedCallWithPath:path serverName:name completionQueue:queue]; + return [channel unmanagedCallWithPath:path serverName:serverName completionQueue:queue]; } - (BOOL)setTLSPEMRootCerts:(nullable NSString *)pemRootCerts |