diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 2a56514bdc9..1ba55a7744d 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -249,7 +249,7 @@ const char *kCFStreamVarName = "grpc_cfstream"; GRPCAssert(!self->_canceled, NSInternalInconsistencyException, @"Call arleady canceled."); GRPCAssert(!self->_finished, NSInternalInconsistencyException, @"Call is half-closed before sending data."); - if (self->_call) { + if (self->_pipe) { [self->_pipe writeValue:data]; } }); diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 52dacad9f50..f63157c9743 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -281,15 +281,14 @@ static const NSTimeInterval kDefaultChannelDestroyDelay = 30; // This function should be called on _dispatchQueue. - (void)ref { - dispatch_sync(_dispatchQueue, ^{ - self->_refcount++; - if (self->_refcount == 1 && self->_lastDispatch != nil) { - self->_lastDispatch = nil; - } - }); + _refcount++; + if (_refcount == 1 && _lastDispatch != nil) { + _lastDispatch = nil; + } } - (void)unref { + NSLog(@"unref"); dispatch_async(_dispatchQueue, ^{ GRPCAssert(self->_refcount > 0, NSInternalInconsistencyException, @"Illegal reference count."); self->_refcount--; diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m index f3fe8bac455..905719f4642 100644 --- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m +++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m @@ -325,7 +325,6 @@ - (void)dealloc { if (_call) { grpc_call_unref(_call); - [_channel unref]; } [_channel unref]; _channel = nil;