aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/GRPCClient/private
diff options
context:
space:
mode:
authorGravatar Muxi Yan <mxyan@google.com>2018-12-06 15:58:53 -0800
committerGravatar Muxi Yan <mxyan@google.com>2018-12-06 15:58:53 -0800
commitf9e50322bf1d6be736b415831eea44130b9dedfe (patch)
tree7da2c7f0be6c10a05303e5215c1630df339744ea /src/objective-c/GRPCClient/private
parenteeced98fc556c6a5bc3a5dedc171c98747217078 (diff)
batch fix
Diffstat (limited to 'src/objective-c/GRPCClient/private')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h49
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannelPool.h28
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannelPool.m7
3 files changed, 52 insertions, 32 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h b/src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h
new file mode 100644
index 0000000000..4e7c988585
--- /dev/null
+++ b/src/objective-c/GRPCClient/private/GRPCChannelPool+Test.h
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright 2018 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#import "GRPCChannelPool.h"
+
+/** Test-only interface for \a GRPCPooledChannel. */
+@interface GRPCPooledChannel (Test)
+
+/**
+ * Initialize a pooled channel with non-default destroy delay for testing purpose.
+ */
+- (nullable instancetype)initWithChannelConfiguration:
+(GRPCChannelConfiguration *)channelConfiguration
+ destroyDelay:(NSTimeInterval)destroyDelay;
+
+/**
+ * Return the pointer to the raw channel wrapped.
+ */
+@property(atomic, readonly) GRPCChannel *wrappedChannel;
+
+@end
+
+/** Test-only interface for \a GRPCChannelPool. */
+@interface GRPCChannelPool (Test)
+
+/**
+ * Get an instance of pool isolated from the global shared pool with channels' destroy delay being
+ * \a destroyDelay.
+ */
+- (nullable instancetype)initTestPool;
+
+@end
+
+
diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.h b/src/objective-c/GRPCClient/private/GRPCChannelPool.h
index 7c6f2b3bbf..d1f28ec9bf 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannelPool.h
+++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.h
@@ -75,23 +75,6 @@ NS_ASSUME_NONNULL_BEGIN
@end
-/** Test-only interface for \a GRPCPooledChannel. */
-@interface GRPCPooledChannel (Test)
-
-/**
- * Initialize a pooled channel with non-default destroy delay for testing purpose.
- */
-- (nullable instancetype)initWithChannelConfiguration:
-(GRPCChannelConfiguration *)channelConfiguration
- destroyDelay:(NSTimeInterval)destroyDelay;
-
-/**
- * Return the pointer to the raw channel wrapped.
- */
-@property(atomic, readonly) GRPCChannel *wrappedChannel;
-
-@end
-
/**
* Manage the pool of connected channels. When a channel is no longer referenced by any call,
* destroy the channel after a certain period of time elapsed.
@@ -119,15 +102,4 @@ NS_ASSUME_NONNULL_BEGIN
@end
-/** Test-only interface for \a GRPCChannelPool. */
-@interface GRPCChannelPool (Test)
-
-/**
- * Get an instance of pool isolated from the global shared pool with channels' destroy delay being
- * \a destroyDelay.
- */
-- (nullable instancetype)initTestPool;
-
-@end
-
NS_ASSUME_NONNULL_END
diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.m b/src/objective-c/GRPCClient/private/GRPCChannelPool.m
index 391022efd1..349bdd44a6 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannelPool.m
+++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.m
@@ -22,6 +22,7 @@
#import "GRPCChannel.h"
#import "GRPCChannelFactory.h"
#import "GRPCChannelPool.h"
+#import "GRPCChannelPool+Test.h"
#import "GRPCConnectivityMonitor.h"
#import "GRPCCronetChannelFactory.h"
#import "GRPCInsecureChannelFactory.h"
@@ -59,9 +60,7 @@ static const NSTimeInterval kDefaultChannelDestroyDelay = 30;
- (void)dealloc {
// Disconnect GRPCWrappedCall objects created but not yet removed
if (_wrappedCalls.allObjects.count != 0) {
- NSEnumerator *enumerator = [_wrappedCalls objectEnumerator];
- GRPCWrappedCall *wrappedCall;
- while ((wrappedCall = [enumerator nextObject])) {
+ for (GRPCWrappedCall *wrappedCall in _wrappedCalls.allObjects) {
[wrappedCall channelDisconnected];
};
}
@@ -73,7 +72,7 @@ callOptions:(GRPCCallOptions *)callOptions {
NSAssert(path.length > 0, @"path must not be empty.");
NSAssert(queue != nil, @"completionQueue must not be empty.");
NSAssert(callOptions, @"callOptions must not be empty.");
- if (path.length == 0 || queue == nil || callOptions == nil) return NULL;
+ if (path.length == 0 || queue == nil || callOptions == nil) return nil;
GRPCWrappedCall *call = nil;