aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2016-03-11 10:49:56 -0800
committerGravatar Jorge Canizales <jcanizales@google.com>2016-03-11 11:50:15 -0800
commit07a2a70bca9a2ffa3c69b43a49f29c4d52808c98 (patch)
tree1014aafddef53469eb5ba3942203426b7edf80da /src/objective-c
parentf1d084a4d159eb07536e4b24f2bf65a3771a747c (diff)
Not call external methods from within a critical section
Diffstat (limited to 'src/objective-c')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.m6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m
index b6a6d48d96..508cb20644 100644
--- a/src/objective-c/GRPCClient/private/GRPCHost.m
+++ b/src/objective-c/GRPCClient/private/GRPCHost.m
@@ -94,12 +94,15 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path
completionQueue:(GRPCCompletionQueue *)queue {
+ GRPCChannel *channel;
+ // This is racing -[GRPCHost disconnect].
@synchronized(self) {
if (!_channel) {
_channel = [self newChannel];
}
- return [_channel unmanagedCallWithPath:path completionQueue:queue];
+ channel = _channel;
}
+ return [channel unmanagedCallWithPath:path completionQueue:queue];
}
- (NSDictionary *)channelArgs {
@@ -136,6 +139,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)disconnect {
+ // This is racing -[GRPCHost unmanagedCallWithPath:completionQueue:].
@synchronized(self) {
_channel = nil;
}