Not call external methods from within a critical section

pull/5720/head
Jorge Canizales 9 years ago
parent f1d084a4d1
commit 07a2a70bca
  1. 6
      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;
}

Loading…
Cancel
Save