aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/GRPCClient
diff options
context:
space:
mode:
Diffstat (limited to 'src/objective-c/GRPCClient')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannel.m2
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannelPool.h4
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannelPool.m8
3 files changed, 9 insertions, 5 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m
index a91949684c..2420988f42 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannel.m
+++ b/src/objective-c/GRPCClient/private/GRPCChannel.m
@@ -204,7 +204,7 @@ NSTimeInterval kChannelDestroyDelay = 30;
if (self->_unmanagedChannel) {
grpc_channel_destroy(self->_unmanagedChannel);
self->_unmanagedChannel = nil;
- [gChannelPool removeChannelWithConfiguration:self->_configuration];
+ [gChannelPool removeChannel:self];
}
});
}
diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.h b/src/objective-c/GRPCClient/private/GRPCChannelPool.h
index bd1350c15d..e9c2ef2bd1 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannelPool.h
+++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.h
@@ -55,8 +55,8 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (GRPCChannel *)channelWithConfiguration:(GRPCChannelConfiguration *)configuration;
-/** Remove a channel with particular configuration. */
-- (void)removeChannelWithConfiguration:(GRPCChannelConfiguration *)configuration;
+/** Remove a channel from the pool. */
+- (void)removeChannel:(GRPCChannel *)channel;
/** Clear all channels in the pool. */
- (void)removeAllChannels;
diff --git a/src/objective-c/GRPCClient/private/GRPCChannelPool.m b/src/objective-c/GRPCClient/private/GRPCChannelPool.m
index bfc624eb4e..b5b3ff60ef 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannelPool.m
+++ b/src/objective-c/GRPCClient/private/GRPCChannelPool.m
@@ -199,9 +199,13 @@ extern const char *kCFStreamVarName;
return channel;
}
-- (void)removeChannelWithConfiguration:(GRPCChannelConfiguration *)configuration {
+- (void)removeChannel:(GRPCChannel *)channel {
@synchronized(self) {
- [self->_channelPool removeObjectForKey:configuration];
+ [_channelPool enumerateKeysAndObjectsUsingBlock:^(GRPCChannelConfiguration * _Nonnull key, GRPCChannel * _Nonnull obj, BOOL * _Nonnull stop) {
+ if (obj == channel) {
+ [self->_channelPool removeObjectForKey:key];
+ }
+ }];
}
}