Resetting _call and _handler on finish

pull/16190/head
Muxi Yan 6 years ago
parent 92e81c80ef
commit b634447d2c
  1. 10
      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. // Clean up _handler so that no more responses are reported to the handler.
self->_handler = nil; 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) { if (self->_call) {
[self->_call cancel]; [self->_call cancel];
self->_call = nil; self->_call = nil;
self->_pipe = nil;
} }
if (self->_handler) { if (self->_handler) {
id<GRPCResponseHandler> handler = self->_handler; id<GRPCResponseHandler> handler = self->_handler;
@ -214,6 +222,8 @@ const char *kCFStreamVarName = "grpc_cfstream";
if (self->_call) { if (self->_call) {
[self->_pipe writesFinishedWithError:nil]; [self->_pipe writesFinishedWithError:nil];
} }
self->_call = nil;
self->_pipe = nil;
}); });
} }

Loading…
Cancel
Save