From 9ae3aeb12f32f472177fd8ba9b1f13437f180044 Mon Sep 17 00:00:00 2001 From: Muxi Yan Date: Thu, 7 Jun 2018 18:15:54 -0700 Subject: Do not register connectivity monitor if using CFStream --- src/objective-c/GRPCClient/GRPCCall.m | 5 ++++- src/objective-c/GRPCClient/private/GRPCHost.m | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'src/objective-c/GRPCClient') diff --git a/src/objective-c/GRPCClient/GRPCCall.m b/src/objective-c/GRPCClient/GRPCCall.m index 5b48d06158..9783b06440 100644 --- a/src/objective-c/GRPCClient/GRPCCall.m +++ b/src/objective-c/GRPCClient/GRPCCall.m @@ -206,8 +206,9 @@ static NSString *const kBearerPrefix = @"Bearer "; } else { [_responseWriteable enqueueSuccessfulCompletion]; } - +#ifndef GRPC_CFSTREAM [GRPCConnectivityMonitor unregisterObserver:self]; +#endif // If the call isn't retained anywhere else, it can be deallocated now. _retainSelf = nil; @@ -462,7 +463,9 @@ static NSString *const kBearerPrefix = @"Bearer "; [self sendHeaders:_requestHeaders]; [self invokeCall]; +#ifndef GRPC_CFSTREAM [GRPCConnectivityMonitor registerObserver:self selector:@selector(connectivityChanged:)]; +#endif } - (void)startWithWriteable:(id)writeable { diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m index bd5fd94118..ac448d0696 100644 --- a/src/objective-c/GRPCClient/private/GRPCHost.m +++ b/src/objective-c/GRPCClient/private/GRPCHost.m @@ -49,7 +49,9 @@ static NSMutableDictionary *kHostCache; if (_channelCreds != nil) { grpc_channel_credentials_release(_channelCreds); } +#ifndef GRPC_CFSTREAM [GRPCConnectivityMonitor unregisterObserver:self]; +#endif } // Default initializer. @@ -84,7 +86,9 @@ static NSMutableDictionary *kHostCache; kHostCache[address] = self; _compressAlgorithm = GRPC_COMPRESS_NONE; } +#ifndef GRPC_CFSTREAM [GRPCConnectivityMonitor registerObserver:self selector:@selector(connectivityChange:)]; +#endif } return self; } -- cgit v1.2.3