Make tests pass

pull/16190/head
Muxi Yan 6 years ago
parent 2bd38f29df
commit b5434c05aa
  1. 2
      src/objective-c/GRPCClient/GRPCCall.m
  2. 9
      src/objective-c/GRPCClient/private/GRPCChannel.m
  3. 1
      src/objective-c/GRPCClient/private/GRPCWrappedCall.m

@ -249,7 +249,7 @@ const char *kCFStreamVarName = "grpc_cfstream";
GRPCAssert(!self->_canceled, NSInternalInconsistencyException, @"Call arleady canceled."); GRPCAssert(!self->_canceled, NSInternalInconsistencyException, @"Call arleady canceled.");
GRPCAssert(!self->_finished, NSInternalInconsistencyException, GRPCAssert(!self->_finished, NSInternalInconsistencyException,
@"Call is half-closed before sending data."); @"Call is half-closed before sending data.");
if (self->_call) { if (self->_pipe) {
[self->_pipe writeValue:data]; [self->_pipe writeValue:data];
} }
}); });

@ -281,15 +281,14 @@ static const NSTimeInterval kDefaultChannelDestroyDelay = 30;
// This function should be called on _dispatchQueue. // This function should be called on _dispatchQueue.
- (void)ref { - (void)ref {
dispatch_sync(_dispatchQueue, ^{ _refcount++;
self->_refcount++; if (_refcount == 1 && _lastDispatch != nil) {
if (self->_refcount == 1 && self->_lastDispatch != nil) { _lastDispatch = nil;
self->_lastDispatch = nil;
} }
});
} }
- (void)unref { - (void)unref {
NSLog(@"unref");
dispatch_async(_dispatchQueue, ^{ dispatch_async(_dispatchQueue, ^{
GRPCAssert(self->_refcount > 0, NSInternalInconsistencyException, @"Illegal reference count."); GRPCAssert(self->_refcount > 0, NSInternalInconsistencyException, @"Illegal reference count.");
self->_refcount--; self->_refcount--;

@ -325,7 +325,6 @@
- (void)dealloc { - (void)dealloc {
if (_call) { if (_call) {
grpc_call_unref(_call); grpc_call_unref(_call);
[_channel unref];
} }
[_channel unref]; [_channel unref];
_channel = nil; _channel = nil;

Loading…
Cancel
Save