aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/GRPCClient/GRPCCall.m
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-11-06 11:07:03 -0800
committerGravatar Muxi Yan <mxyan@google.com>2018-11-06 11:07:03 -0800
commitb496e3a2663824c22806b7ee7b1423c806ecc61a (patch)
treef44216fad5fd65ec50791f4cd2093c42ed5f91ae /src/objective-c/GRPCClient/GRPCCall.m
parent6b8f0ceae8f581cfd63b40c4e2ccab95783081ae (diff)
On finish, clean _handler and _call independently
Diffstat (limited to 'src/objective-c/GRPCClient/GRPCCall.m')
-rw-r--r--src/objective-c/GRPCClient/GRPCCall.m11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m
index 2f727e62be..af14193581 100644
--- a/src/objective-c/GRPCClient/GRPCCall.m
+++ b/src/objective-c/GRPCClient/GRPCCall.m
@@ -184,6 +184,11 @@ const char *kCFStreamVarName = "grpc_cfstream";
}
completionHandler:^(NSError *errorOrNil) {
dispatch_async(self->_dispatchQueue, ^{
+ if (self->_call) {
+ [self->_pipe writesFinishedWithError:nil];
+ self->_call = nil;
+ self->_pipe = nil;
+ }
if (self->_handler) {
if (!self->_initialMetadataPublished) {
self->_initialMetadataPublished = YES;
@@ -193,12 +198,6 @@ const char *kCFStreamVarName = "grpc_cfstream";
// Clean up _handler so that no more responses are reported to the handler.
self->_handler = nil;
-
- if (self->_call) {
- [self->_pipe writesFinishedWithError:nil];
- self->_call = nil;
- self->_pipe = nil;
- }
}
});
}];