Resetting _call and _handler on finish
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m
index ace149f..d0495f6 100644
--- a/src/objective-c/GRPCClient/GRPCCall.m
+++ b/src/objective-c/GRPCClient/GRPCCall.m
@@ -170,6 +170,13 @@
// Clean up _handler so that no more responses are reported to the handler.
self->_handler = nil;
+
+ // If server terminated the call we should close the send path too.
+ if (self->_call) {
+ [self->_pipe writesFinishedWithError:nil];
+ self->_call = nil;
+ self->_pipe = nil;
+ }
}
});
}];
@@ -182,6 +189,7 @@
if (self->_call) {
[self->_call cancel];
self->_call = nil;
+ self->_pipe = nil;
}
if (self->_handler) {
id<GRPCResponseHandler> handler = self->_handler;
@@ -214,6 +222,8 @@
if (self->_call) {
[self->_pipe writesFinishedWithError:nil];
}
+ self->_call = nil;
+ self->_pipe = nil;
});
}