Skip to content
Snippets Groups Projects
Commit 07a2a70b authored by Jorge Canizales's avatar Jorge Canizales
Browse files

Not call external methods from within a critical section

parent f1d084a4
No related branches found
No related tags found
No related merge requests found
...@@ -94,12 +94,15 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -94,12 +94,15 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path - (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path
completionQueue:(GRPCCompletionQueue *)queue { completionQueue:(GRPCCompletionQueue *)queue {
GRPCChannel *channel;
// This is racing -[GRPCHost disconnect].
@synchronized(self) { @synchronized(self) {
if (!_channel) { if (!_channel) {
_channel = [self newChannel]; _channel = [self newChannel];
} }
return [_channel unmanagedCallWithPath:path completionQueue:queue]; channel = _channel;
} }
return [channel unmanagedCallWithPath:path completionQueue:queue];
} }
- (NSDictionary *)channelArgs { - (NSDictionary *)channelArgs {
...@@ -136,6 +139,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -136,6 +139,7 @@ NS_ASSUME_NONNULL_BEGIN
} }
- (void)disconnect { - (void)disconnect {
// This is racing -[GRPCHost unmanagedCallWithPath:completionQueue:].
@synchronized(self) { @synchronized(self) {
_channel = nil; _channel = nil;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment