Assign finished and canceled

pull/16190/head
Muxi Yan 6 years ago
parent b77203fdf5
commit 78c2176afc
  1. 4
      src/objective-c/GRPCClient/GRPCCall.m

@ -143,7 +143,7 @@ const char *kCFStreamVarName = "grpc_cfstream";
dispatch_set_target_queue(responseHandler.dispatchQueue, _dispatchQueue); dispatch_set_target_queue(responseHandler.dispatchQueue, _dispatchQueue);
_started = NO; _started = NO;
_canceled = NO; _canceled = NO;
_finished = YES; _finished = NO;
} }
return self; return self;
@ -218,6 +218,7 @@ const char *kCFStreamVarName = "grpc_cfstream";
- (void)cancel { - (void)cancel {
dispatch_async(_dispatchQueue, ^{ dispatch_async(_dispatchQueue, ^{
GRPCAssert(!self->_canceled, NSInternalInconsistencyException, @"Call already canceled."); GRPCAssert(!self->_canceled, NSInternalInconsistencyException, @"Call already canceled.");
self->_canceled = YES;
if (self->_call) { if (self->_call) {
[self->_call cancel]; [self->_call cancel];
self->_call = nil; self->_call = nil;
@ -263,6 +264,7 @@ const char *kCFStreamVarName = "grpc_cfstream";
[self->_pipe writesFinishedWithError:nil]; [self->_pipe writesFinishedWithError:nil];
} }
self->_pipe = nil; self->_pipe = nil;
self->_finished = YES;
}); });
} }

Loading…
Cancel
Save