diff options
author | Muxi Yan <mxyan@google.com> | 2018-10-11 13:15:45 -0700 |
---|---|---|
committer | Muxi Yan <mxyan@google.com> | 2018-10-11 13:15:45 -0700 |
commit | b634447d2cb762b47365218e1affd317a4ccd8b3 (patch) | |
tree | abe307d293ff7ce1de38609710c52aae400a1f77 /src/objective-c/GRPCClient | |
parent | 92e81c80efb8d5dcbc6362206be09b2ef9107a2b (diff) |
Resetting _call and _handler on finish
Diffstat (limited to 'src/objective-c/GRPCClient')
-rw-r--r-- | src/objective-c/GRPCClient/GRPCCall.m | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index ace149fad5..d0495f6cbf 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -170,6 +170,13 @@ const char *kCFStreamVarName = "grpc_cfstream"; // 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 @@ const char *kCFStreamVarName = "grpc_cfstream"; if (self->_call) { [self->_call cancel]; self->_call = nil; + self->_pipe = nil; } if (self->_handler) { id<GRPCResponseHandler> handler = self->_handler; @@ -214,6 +222,8 @@ const char *kCFStreamVarName = "grpc_cfstream"; if (self->_call) { [self->_pipe writesFinishedWithError:nil]; } + self->_call = nil; + self->_pipe = nil; }); } |